I am trying to insert spaces in string
for example:
string = "hellohowarejames"
i woud like to insert a space for every 4 letters
so it will look like
"hell ohow arej ames"
Printable View
I am trying to insert spaces in string
for example:
string = "hellohowarejames"
i woud like to insert a space for every 4 letters
so it will look like
"hell ohow arej ames"
Something like this untested, bug filled code?
Code:string AddSpaces(string Input)
{
int length = Input.size();
string output = string.empty;
//for each block of 4 characters
for(int i =0 ; i< length; i=i+4)
{
//copy 4 characters and a space to the output
output += Input.substr(i, 4) + " ";
}
return output;
}
You are lucky I did not writeI am coding everyday in PL/SQL, C#, VB.NET and ASP.NET at the moment, with some JavaScript thrown in to be annoying.Code:output := '';
I keep mixing syntax up and adding 'THEN' after loops/IFs.
Worse is when I code in PL/SQLCode:IF (someVar <> NULL) THEN