GitHub - prabeenragupathi/stringFunctions: This header file has a functions which are using in javascript.
Hi, I'm Prabeen! ๐
๐ About Me
I'm a developer... I know web development and app development.
๐ Skills
Javascript, HTML, CSS, C++,Java...
๐ Links
String Functions
This header file has a functions which are only use in java and javascript.
- trim()
- trimStart()
- trimEnd()
- indexOf()
- charAt()
- capitalize()
- toLowerCase()
- toUpperCase()
- slice()
- substr()
- substring()
- isEndsWith()
- isStartsWith()
Advantages
- Save Time
- Easy to Use
Examples
In this functions we should pass the string as first parameter.
how to include this header file
#include "stringFunctions.h"
trim function
int main(){ string sample = " This created by prabeen "; cout << trim(sample); }
trimStart function
int main(){ string sample = " This created by prabeen "; cout << trimStart(sample); }
trimEnd function
int main(){ string sample = " This created by prabeen "; cout << trimEnd(sample); }
capitalize function
int main(){ string sample = " This created by prabeen "; cout << capitalize(sample); }
toLowerCase function
int main(){ string sample = " This created by prabeen "; cout << toLowerCase(sample); }
toUpperCase function
int main(){ string sample = " This created by prabeen "; cout << toUpperCase(sample); }
substr function
int main(){ string sample = " This created by prabeen "; //cout << substr(sample,start_index,end_index); cout << substr(sample,3,6); }
substring function
int main(){ string sample = " This created by prabeen "; //cout << substring(sample,start_index,end_index); cout << substring(sample,3,6); }
slice function
int main(){ string sample = " This created by prabeen "; //cout << slice(sample,start_index,end_index); cout << slice(sample,3,6); }
charAt function
int main(){ string sample = " This created by prabeen "; //cout << charAt(sample,position); cout << charAt(sample,7); }
indexOf function
int main(){ string sample = " This created by prabeen "; //cout << indexOf(sample,'char'); cout << substr(sample,'c'; }
isStartsWith function
int main(){ string sample = " This created by prabeen "; //cout << isStartsWith(sample,"t"; cout << isStartsWith(sample,3,6); //this function return value in bool format }
isEndsWith function
int main(){ string sample = " This created by prabeen "; //cout << isEndsWith(sample,"t"; cout << isEndsWith(sample,3,6); //this function return value in bool format }