Questions tagged [strrchr]

25 questions
0
votes
0 answers

Using character in string to find a print data lines

So i have an array of strucures, lets say student grades. A undetermined lenght list of data (loaded by a file) in the format student:test1:test2:lettergrade I want to be able to "search" by prompting the user to enter a letter grade, and after…
champlooSIXSIX
  • 131
  • 1
  • 1
  • 9
0
votes
1 answer

Segmentation Fault when using strrchr()

I am trying to remove the last comma from a record. I use strrchr() to find the last occurrence of ',' in the record and set it to the null termination. For some reason it is not finding the last occurrence of the comma and giving a "segmentation…
Kyle Jensen
  • 419
  • 9
  • 27
0
votes
3 answers

What is opposite of strrchr function?

I want to remove all characters after last specific string. For this function I need opposite of strrchr function. For example, I want to remove all characters after last "." from "Hello.World.pdf". But with strrchr function I can only remove…
0
votes
1 answer

strrchr only displaying items in string after slash

I'm referencing to an array and this is only showing the part of string after the slash. How do I show the characters before it also. #Check for bio if ($biosDisplayed == $y) { $positionTitle = strpos($bios[$i], " /"); …
Woovils
  • 3
  • 1
-1
votes
1 answer

How come we have to dereference the pointer returned from strbrk(), but don't have to derefence the pointer returned from strrchr()?

How come we have to dereference the pointer returned from strbrk(), but don't have to derefence the pointer returned from strrchr()? So I have the code below: #include #include int main(void){ const char *string1 = "This…
-1
votes
2 answers

strrchr strtok php not working (extract everything after id=

been on this for 2 hours now ... $string = "https://www.example.com/?id=fsdf29512590125Agajgenaemganheji"; $end = strrchr($string, 'id='); // should return "fsdf29512590125Agajgenaemganheji" echo $end; only returns "i" these work but not in larger…
user21315634
-1
votes
2 answers

How can i replace the first CR LF and Tabulation with space

enter image description hereso i have this format of the text in below and i need to replace the first CR LF tabulation with space : Contenu 2 encarts 12 encarts Prepresse Fichier fourni and i want the result: Contenu 2 encarts …
blood
  • 35
  • 3
-1
votes
1 answer

Get characters in between last occurrence of a string and another string

I want to get get the text in between the last occurrence of a string and another string The following does not seem to work: preg_match('/'.preg_quote('{').'(.*?)'.preg_quote($rddaddress).'/is', $apiurlTXinfo, $statTXinfogot); preg_match('/' .…
Sawyer
  • 29
  • 5
-3
votes
1 answer

Make own strrchr() function but case-insensitiv

my exercise is to create my own strrchr() function in c. My solution is a loop. I'am counting the array length. I will input this number into the for loop. For example: With the input Hello. I will go from right to left to search for a…
-9
votes
1 answer

How can I write actual strrchr function in C language?

Description Searches for the last occurrence of the character c (an unsigned char) in the string pointed to by the argument str. The terminating null character is considered to be part of the string. Returns a pointer pointing to the last matching…
1
2