ExpandCollapseNext Index

+ 1.1 Reference.

See string module.

+ 1.2 Concept.

Felix uses a binding to the C++ string datatype {::std::basic_string<char>}.

+ 1.3 String subscript and slices.

  //Check String::subscript
  print$ "hello how are you".[4]; endl;
  print$ "hello how are you".[5 to]; endl;
  print$ "hello how are you".[to 7]; endl;
  print$ "hello how are you".[3 to 8]; endl;
  

o
 how are you
hello h
lo ho

+ 1.4 Left trim ltrim.

  //Check String::ltrim
  print$ ltrim "hello how are you" "hello"; endl;
  print$ ltrim "hello how are you" "goodbye"; endl;
  

 how are you
hello how are you

+ 1.5 Right trim rtrim.

  //Check String::rtrim
  print$ rtrim "hello how are you" "you"; endl;
  print$ rtrim "hello how are you" "me"; endl;
  
  

hello how are 
hello how are you

+ 1.6 Trim both ends trim.

  //Check String::trim
  print$ trim "hello how are you" "me"; endl;
  print$ trim "hello how are you" "hello"; endl;
  print$ trim "hello how are you" "you"; endl;
  
  print$ trim "hello how are hello" "hello"; endl;
  print$ trim "hello how are hello" "goodbye"; endl;
  

hello how are you
 how are you
hello how are 
 how are 
hello how are hello

+ 1.7 Left strip lstrip.

  //Check String::lstrip
  print$ lstrip "  a b c  "; endl;
  print$ lstrip "a b c  "; endl;
  

a b c  
a b c  

+ 1.8 Right strip rstrip.

  //Check String::rstrip
  print$ rstrip "  a b c  "; endl;
  print$ rstrip "  a b c"; endl;
  

  a b c
  a b c

+ 1.9 Strip both ends strip.

  //Check String::strip
  print$ strip "  a b c  "; endl;
  print$ strip "a b c"; endl;
  

a b c
a b c