Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex
Normal file
16
Task/Substring-Top-and-tail/Apex/substring-top-and-tail.apex
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
String strOrig = 'brooms';
|
||||
String str1 = strOrig.substring(1, strOrig.length());
|
||||
system.debug(str1);
|
||||
String str2 = strOrig.substring(0, strOrig.length()-1);
|
||||
system.debug(str2);
|
||||
String str3 = strOrig.substring(1, strOrig.length()-1);
|
||||
system.debug(str3);
|
||||
|
||||
// Regular Expressions approach
|
||||
String strOrig = 'brooms';
|
||||
String str1 = strOrig.replaceAll( '^.', '' );
|
||||
system.debug(str1);
|
||||
String str2 = strOrig.replaceAll( '.$', '' ) ;
|
||||
system.debug(str2);
|
||||
String str3 = strOrig.replaceAll( '^.|.$', '' );
|
||||
system.debug(str3);
|
||||
Loading…
Add table
Add a link
Reference in a new issue