Last active
June 11, 2017 17:26
-
-
Save Ncreshon/0bb59fb85cd92cfd4083b40dbb93aa32 to your computer and use it in GitHub Desktop.
JS Bin[String Manipulation]// source https://jsbin.com/gojoca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //String Manipulation// | |
| /* String manipulation are the various ways to conveting strings*/ | |
| var hello = "Hello World!" | |
| //Types of string manipulation functions// | |
| //charAt() finds the character at a specified position (0 indexed)// | |
| console.log(hello.charAt(2)); //consoles l// | |
| //concat() combines one or more strings and returns the combined string// | |
| console.log(hello.concat(" It'sa Me Mario!")); // Hello World! It'sa Me Mario!// | |
| /* split() splits strings into an array of substrings. You can add a | |
| * seperator inside the () to seperate them*/ | |
| console.log(hello.split( )); //["Hello World!']// | |
| console.log(hello.split("")); //['H',"e","l",...]// | |
| /* takes off a portion of a string starting at "start' until it reaches | |
| * a specficed length*/ | |
| console.log(hello.substr(2)); // "llo World!"// | |
| /* substring() extracts the characters within a string between 2 | |
| *specified positions */ | |
| console.log(hello.substring(3,7)); // "lo W"// | |
| /* toLowerCase() returns a string will all lowercase letters*/ | |
| console.log(hello.toLowerCase());// "hello world!"// | |
| /*toUpperCase() returns a string will all uppercase letters*/ | |
| console.log(hello.toUpperCase()); // "HELLO WORLD!"// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment