Changes

Jump to navigation Jump to search
m
→‎top: clean up
Line 1: Line 1: −
'''Extracting parts of a string''' works slightly different in major computer languages. Java and PHP take entirely different approaches, while JavaScript combines the best of each.
+
'''Extracting parts of a string''' works slightly different in major [[programming language|computer languages]]. [[Java]] and [[PHP]] take entirely different approaches, while [[JavaScript]] combines the best of each.
    
Java has the substring method [http://download.oracle.com/javase/1,5.0/docs/api/java/lang/String.html#substring(int, int)] which extracts a string beginning at the first argument, and ending just before the second argument. Each argument is an index into the string, taken as an offset from the first character.
 
Java has the substring method [http://download.oracle.com/javase/1,5.0/docs/api/java/lang/String.html#substring(int, int)] which extracts a string beginning at the first argument, and ending just before the second argument. Each argument is an index into the string, taken as an offset from the first character.
Line 7: Line 7:  
The substring method in JavaScript works the same as in Java. The substr method in JavaScript is basically the same as in PHP, with JavaScript's two arguments corresponding to the last 2 arguments in PHP. However, in Javascript, a negative start is treated the same as zero.
 
The substring method in JavaScript works the same as in Java. The substr method in JavaScript is basically the same as in PHP, with JavaScript's two arguments corresponding to the last 2 arguments in PHP. However, in Javascript, a negative start is treated the same as zero.
   −
[[category:Computer Programming]]
+
[[Category:Computer Programming]]
Block, SkipCaptcha, apieditor, Automoderated users, Bots, edit, ratelimit-exempt
58,466

edits

Navigation menu