- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 35164 Articles for Programming
153 Views
The strncmp() function is used to compare first n character.Note − The function is case-sensitive.Syntaxstrncmp(str1, str2, len)Parametersstr1 − The first stringstr2 − The second stringlen − The number of characters to use in the comparison.ReturnThe strncmp() function returns −0 - if the two strings are equal0 - if string1 is greater than string2ExampleThe following is an example − Live DemoOutputThe following is the output −8192ExampleLet us see another example − Live DemoOutputThe following is the output −-32
74 Views
The strncasecmp() function is used to compare two strings. Note − The function is case-insensitive. Syntax strncasecmp(str1,str2,len) Parameters str1 − First string to compare str2 − Second string to compare len − The length of strings to be used while comparing Return The strcoll() function returns − 0 − if the two strings are equal < 0 − if string1 is less than string2 > 0 − if string1 is greater than string2 Example The following is an example − Live Demo Output 0
95 Views
The strnatcmp() function is used compare two strings with a natural order algorithm.Syntaxstrnatcmp(str1, str2)Parametersstr1 − First string to compare.str2 − Second string to compareReturnThe strnatcmp() function returns −0 - if the two strings are equal0 - if string1 is greater than string2ExampleThe following is an example − Live DemoOutputThe following is the output −1ExampleLet us see another example − Live DemoOutputThe following is the output −-1 1 0
94 Views
The strnatcasecmp() function is used compare two strings with a natural algorithm. Note − The function is case sensitive. Syntax strnatcasecmp(str1, str2) Parameters str1 − First string to compare str2 − Second string to compare Return The strcoll() function returns − 0 − if the two strings are equal < 0 − if string1 is less than string2 > 0 − if string1 is greater than string2 Example The following is an example − Live Demo Output 0 Example The following is an example − Live Demo Output -1 1 0
12K+ Views
The strlen() function is used to get the string length. It returns the length of the string on success. If the string is empty, 0 is returned.Syntaxstrlen(str)Parametersstr − The string for which we want the length.ReturnThe strlen() function returns the length of the string on success. If the string is empty, 0 is returned.ExampleThe following is an example − Live DemoOutputThe following is the output −10
244 Views
The stripslashes() function is used to un-quote a quoted string.Syntaxstripslashes(str)Parametersstr − Specify the string.ReturnThe stripslashes() function returns a string with backslashes stripped off i.e '\' becomes '. The double backslashes (\) are form into a single backslash (\).ExampleThe following is an example − Live DemoOutputThe following is the output −Tom Hanks
188 Views
The stristr() function is used to search for the first occurrence of a string inside another string.Note − The function is case-insensitiveSyntaxstristr(str, search, before_search)Parametersstr − The string to search insearch − The string to search forbefore_search − A boolean value whose default is "false". If set to "true", it returns the part of the string before the first occurrence of the search parameter.ReturnThe stristr() function returns the matched substring.ExampleThe following is an example − Live DemoOutputTim is not in the string!ExampleThe following is an example − Live DemoOutputDemo
222 Views
The stripos() function is used to find the position of first occurrence of a string inside the another string. Note − The function is case-insensitive. Syntax stripos(str, search, begin) Parameters str − The string to search in search − The string to search begin − Where to begin the search Return The stripos() function returns the position of the first occurrence of a string inside another string. Example The following is an example − Live Demo Output 0
195 Views
The stripclashes() is used to remove backslashes. It returns the unescaped string. Syntax stripclashes(str) Parameters str − Specify the string to check. Return The stripcslashes() function returns the unescaped string. The following is an example − Example Live Demo The following is the output − Output Naomi Watts!
134 Views
The strip_tags() function is used to strip HTML and PHP tags from a string. Syntax strip(str, allow) Parameters str − The string to check allow − The allowable tags that won’t be removed (won’t be stripped). Return The strip_tags() function returns the stripped string. Example The following is an example − Live Demo Output Demo Text! Example The following is an example − Live Demo Output Demo Text!>/strong>
To Continue Learning Please Login
Login with Google