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

  • Home
  • SEARCH
  • 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 7848495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:13:30+00:00 2026-06-02T18:13:30+00:00

ok so I have this string. Next: Warrant Officer Grade 2 21,202 / 33,000

  • 0

ok so I have this string.

Next: Warrant Officer Grade 2
21,202 / 33,000
21,202 / 33,000

It is a substring I have obtained from a long thing of text. Now “Warrent Officer Grade 2” as well as the numbers can be dynamic (I am loading these variables from a webpage) If there is a number in the ones or hundreds it does not append 0’s so the exp for less than a thousand would look like “478” instead of 00,478.

Now my question is how to I obtain just “Warrant Officer Grade 2”? I already have this

int indexOfNext = myString.IndexOf("Next") + 6;  
//Below is what I need to obtain  
int count = 0;  
string newString = myString.Substring(indexOfNext, count);

But how would I help determine the count for getting the rank? or would It just be simple to create an array with all the ranks and the length of each rank?

  • 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-02T18:13:32+00:00Added an answer on June 2, 2026 at 6:13 pm

    You can use regular expression to search for the name and level for example

    var regExp = new Regex(@"^Next: (?<name>[^\d]+) Grade (?<level>[\d]+)");
    

    this will match all lines starting with Next: followed with the name, Grade word and level. The captured values of name and level groups can be retrieved later

    var match = regExp.Match(input);
    var level = match.Groups["level"].Value; 
    

    or modify it the way you want it.

    Regex playground: Derek Slager’s A Better .NET Regular Expression Tester

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

Sidebar

Related Questions

I have this string: comment_1234 I want to extract the 1234 from the string.
I have this string: $str = '<div class=defaultClass>...</div>'; how do I append 'myClass' next
I have this code: String s = A very long string containing + many
one thing that i always wondered, if i have a method like this: String
I have this in my header struct str_list_element_struct { char* string; struct str_list_element_struct* next;
So, I have this next button which calls a string array and when count
Hi All I have a string like this var data='mobile,car,soap,room'; I am parsing from
I have this string: 123-456-7 I need to get this string: 1234567 How I
I have this string: \Blah \'Blah\' Blah\ . There is another string inside it.
I have this string stored in a variable: IN=bla@some.com;john@home.com Now I would like to

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.