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 6596719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:06:44+00:00 2026-05-25T18:06:44+00:00

How can I break this string for licence plates v/s states? I have unique

  • 0

How can I break this string for licence plates v/s states?

I have unique VIN Numbers in my database for every vehicle.

VIN varchar2(100)
Make varchar2(100)
Model varchar2(100)
Year varchar2(4)
PlateInfo varchar2(1000)

The objective is to take the string in the PlateInfo field and split it to states and the license plates.
There are vehicles who have had more than 24 owner / plate changes.

The string in plate info typically looks like this.

MA~CT~DE~NJ~NJ~~~~~~VEG-1825~AX7547~117824~NEG-1012~BEG-1011~~ 

This needs to split into two columns StateId, PlateId

MA:VEG-1825
CT:AX7547
DE:117824
NJ:NEG-1012
NJ:BEG-1011

I was able to do this making an assumption that the number of occurrences for the tilde “~” character will always be an even number.

However when I ran this against the database, I found there are several vehicles where the information looks like this.

CT~DC~DE~MA~MD~NY~RI~VA~WA~WV~ 

My client wants me to put this in a state column with a null column for the plate. How can I achieve this? Would it be fair to make the assumption that each 2 character is a state, then validate it against the 50 states?

  • 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-05-25T18:06:45+00:00Added an answer on May 25, 2026 at 6:06 pm

    Assuming that your input string is a list of 10+ items where each item is terminated by a ~, e.g.

    "0~1~2~3~4~5~6~7~8~9~"
    "0~1~2~3~4~5~6~7~8~9~10~11~12~13~14~15~16~17~18~19~"
    

    you can remove the last ~ and split the string by ~:

    var parts = input.TrimEnd('~')
                     .Split('~');
    

    The states seem to be the first 10 non-empty elements (see @Reed Copsey‘s answer):

    var states = parts.Take(10)
                      .Where(s => s != "");
    

    The plates seem to be the second 10 elements, which need to be padded with nulls if necessary:

    var plates = parts.Skip(10)
                      .Take(10)
                      .Concat(Enumerable.Repeat<string>(null, 10));
    

    Then zip the states and the plates as follows:

    foreach (var item in states.Zip(plates, (state, plate) => new { state, plate }))
    {
        Console.WriteLine("{0,-10} {1}", item.state, item.plate);
    }
    

    Example 1:

    MA         VEG-1825
    CT         AX7547
    DE         117824
    NJ         NEG-1012
    NJ         BEG-1011
    

    Example 2:

    CT         <null>
    DC         <null>
    DE         <null>
    MA         <null>
    MD         <null>
    NY         <null>
    RI         <null>
    VA         <null>
    WA         <null>
    WV         <null>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make this work? switch(property.PropertyType){ case typeof(Boolean): //doStuff break; case typeof(String): //doOtherStuff
Suppose I had a string: string str = "1111222233334444"; How can I break this
can some 1 tell how to break this sort of String in smarty what
I have this string to be encoded (with line break) Sender ID Sender ID
[1,2,3].forEach(function(el) { if(el === 1) break; }); How can I do this using the
How can I set a break point in a javascript function and have the
I have this code below where I loop through string and compare everything char
How can I break a string up by spaces in PHP, respecting quoted sub
I have an input string in the following format: 12.34 When I call this
I'm trying to break up this string, AFRIKAANS = af ALBANIAN = sq AMHARIC

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.