Skip to main content

All Questions

5 votes
1 answer
131 views

What does ranges::starts_with do with C-style string argument(s)?

The following code prints 1010 #include <iostream> #include <range/v3/algorithm/starts_with.hpp> int main () { using namespace std::literals; std::cout << ranges::...
Enlico's user avatar
  • 28.9k
0 votes
1 answer
755 views

Finding substrings in c(Question 8.16 from C how to program)

I am trying to implement the question 8.16 from the C How to program. The question is below: (Searching for Substrings) Write a program that inputs a line of text and a search string from the ...
akoluacik's user avatar
1 vote
2 answers
141 views

checking if a string is in another string without pointers in C

i've just started c programming and the task is to write a program to find a string in another string and if the target string was found print "Yes" and if it wasn't print "No". i've written a ...
Palreza's user avatar
  • 59
1 vote
3 answers
2k views

Count number of substrings having only vowels

I wrote a code to find the vowel substrings of the given substring. but i need help in counting the substring thus formed? code: #include <stdio.h> #include <string.h> #include <...
simon cowell's user avatar
0 votes
3 answers
165 views

Is there a better way to write this for C++? [closed]

The goal is to create substrings from an inputted string by extracting words which are separated by spaces. The substrings have to be variables themselves. Sounds easy, but what makes it hard is ...
user12414777's user avatar
1 vote
2 answers
333 views

how to index a string in C like a string in python?

For example, in python, you can index strings like this some_string = "hello" substring = some_string[0:3] and substring will be "hel" however, in C, if I have char some_string[] = {'h', 'e', 'l', '...
Thomas's user avatar
  • 43
1 vote
3 answers
7k views

C - Get substring after first n characters of string

This is proving to be surprisingly hard to do, and I have yet to find a straightforward solution looking through existing questions. I've looked at several duplicate questions, but they aren't what I'...
123's user avatar
  • 8,981
1 vote
1 answer
928 views

Will strstr return the same pointer as the first string if the second string is at the beginning?

So basically, I need to find out if a string begins with [URL] and ends with [/URL]. Right now I'm doing: const char *urlStart; // ... urlStart = strstr(message, "[URL]"); if (urlStart == NULL) { ...
NobleUplift's user avatar
  • 6,053