Skip to content

This header file has a functions which are using in javascript.

Notifications You must be signed in to change notification settings

prabeenragupathi/stringFunctions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Hi, I'm Prabeen! 👋

🚀 About Me

I'm a developer... I know web development and app development.

🛠 Skills

Javascript, HTML, CSS, C++,Java...

🔗 Links

instagram

String Functions

This header file has a functions which are only use in java and javascript.

Functions

  • 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
}