answersLogoWhite

0


Best Answer

size_t trim (char *p)

{

char *from, *lim, *to;

from= p;

lim= p + strlen (p);

to= p;

while (lim>from && lim[-1]==' ') --lim;

while (from<lim && from[0]==' ') ++ from;

while (from<lim) *to++ = *from++;

*to= '\0';

return to-p;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a function to remove any leading or trailing blank from a string?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What method of the string class removes all spaces from the beginning and end of a string object?

String a=" Suraj "; String t=a.trim(); this will remove all the leading and trailing white spaces


Geta is a math function or string function?

GetA is a math function and not a string function.


How does one use the Perl chomp function?

The Perl Chomp function is a programming function that remove the "newline" character at the end of the string. One can use the Perl Chomp function to remove any character that has the same value as the current one.


Which is string function starchy or strlength?

The string function is strlength and it is evoked to return the length of a string.


How do you reverse a string in PHP without using a function?

Without any function is impossible. So I'll assume you mean any coded function, in which case the predefined function below is your answer.$string = strrev($string);


What is Trim in C sharp?

System.String.Trim() is an instance method that works on System.String objects. It removes any leading and trailing white space from the string. The MSDN article on this method can be found here: http://msdn.microsoft.com/en-us/library/t97s7bs3.aspx Example: void Main() { string classicFirstProgram = " Hello World! "; classicFirstProgram = classicFirstProgram.Trim(); Console.WriteLine(classicFirstProgram); }


What function are used for string length in visual basic?

string length is a function use to check the lenght of a string i.e number of alphabets in a word or sentence.


How string can be passed to a function in c?

between parentheses: funname ("string")


Reverse of a string without using string handling function?

shashi


Which text function replaces text in a string?

The REPLACE function.


Concat a string without using any inbuilt function in java?

Use "+". Example: String string = "does this answer " + "your question?";


Write the function replace which finds the string from in the string string and replaces it with the?

Hay buddy this is homework. U have to solve it by urself.