Difference between revisions of "Findchar"
From Mesham
Jump to navigationJump to search (Created page with '== Overview == This findchar(s, c) function will return the index of the first occurrence of character ''c'' in string ''s''. * '''Pass:''' A String and Char * '''Retur…') |
|||
Line 10: | Line 10: | ||
#include <string> | #include <string> | ||
− | var a:="hello"; | + | |
− | + | function void main() { | |
+ | var a:="hello"; | ||
+ | var c:=findchar(a,'l'); | ||
+ | }; | ||
''Since: Version 1.0'' | ''Since: Version 1.0'' |
Revision as of 14:33, 15 April 2013
Overview
This findchar(s, c) function will return the index of the first occurrence of character c in string s.
- Pass: A String and Char
- Returns: An Int
- Throws: The error string notfound if the character does not exist within the string
Example
#include <string> function void main() { var a:="hello"; var c:=findchar(a,'l'); };
Since: Version 1.0