Categories > Original > Essay > Coding
modulu- remainder something%something
The number part is a little strange. To select for the "he" in "hello", you would write this:
"hello". substring(0, 2);
Each character in a string is numbered starting from 0, like this:
0 1 2 3 4
| | | | |
h e l l o
The letter h is in position 0, the letter e is in position 1, and so on.
Therefore if you start at position 0, and slice right up till position 2, you are left with just he
The number part is a little strange. To select for the "he" in "hello", you would write this:
"hello". substring(0, 2);
Each character in a string is numbered starting from 0, like this:
0 1 2 3 4
| | | | |
h e l l o
The letter h is in position 0, the letter e is in position 1, and so on.
Therefore if you start at position 0, and slice right up till position 2, you are left with just he
Sign up to rate and review this story