Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:43:47+00:00 2026-06-04T20:43:47+00:00

What I need to do is find what position a certain string is at,

  • 0

What I need to do is find what position a certain string is at, and only keep what’s after that.

Pseudo-code:

string1 = "CDSDC::walrus"
string2 = "::"
string3 = (substr( string1, strfind(string1, string2) + 2 )) // +2 being the len of str2
// at this point I want string3 == "walrus"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:43:48+00:00Added an answer on June 4, 2026 at 8:43 pm

    strstr does what you want. ie locate substrings.

    const char * strstr ( const char * str1, const char * str2 );
    

    Returns a pointer to the first occurrence of str2 in str1, or a null
    pointer if str2 is not part of str1.

    For your example,

    char *string3 = strstr(string1,"walrus")
    

    Or, if you want to split strings into tokens based on delimiters like :: use can use strtok

    char * strtok ( char * str, const char * delimiters );
    

    Split string into tokens

    A sequence of calls to this function split str into tokens, which are
    sequences of contiguous characters separated by any of the characters
    that are part of delimiters.

    For your example,

    strtok(string1, "::");
    string3 = strtok(NULL,"::")
    

    strtok is a tricky function in the sense that it modifies the string you are tokenizing and is also not re-rentrant. Here is a nice article explaining the overall aspects of using strtok

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RichTextBox and I need to find the position of the vertical
I need to find out the pixel position of one element in a list
I need to find a silence in a mp3 file. Simple as that. For
I need to find out the value passed into an indexer. My code (c#)
I have an associative array and I need to find the numeric position of
Given an email address column, I need to find the position of the @
I need to find an element position in an std::vector to use it for
I need to find out at what position in terms of parent > child:eq(n)
I need to find if the mouse position is inside an NSView's rect. I'd
I have a large string (multiple lines) I need to find numbers in with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.