answersLogoWhite

0

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

15y ago

What else can I help you with?

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 trailing spaces?

Trailing spaces refer to any whitespace characters, such as spaces or tabs, that appear at the end of a line or string but serve no functional purpose. They can occur accidentally during text editing and may lead to issues in programming, data processing, or text formatting. In many programming languages, trailing spaces can affect string comparisons and code execution, so they are often removed during data cleaning processes.


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.


Reverse of a string without using string handling function?

shashi


How string can be passed to a function in c?

between parentheses: funname ("string")


How can I remove hex characters from a string in Python?

To remove hex characters from a string in Python, you can use the regular expression module re and the sub function. Here is an example code snippet: python import re def removehex(inputstring): return re.sub(r'x00-x7F', '', inputstring) inputstring &quot;Hellox00World&quot; outputstring removehex(inputstring) print(outputstring) This code snippet defines a function removehex that uses a regular expression to remove any non-ASCII characters (hex characters) from the input string.


Which text function replaces text in a string?

The REPLACE function.


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); }