CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2013
    Posts
    3

    Smile concatenation of string and assigning to a varibale

    Hello,
    I have a c#program,where the string is "time warner cable,charlotte,NC"
    so I haave to split this string(comma separated) and I need to get only first value as time warner cable

    so that I need to change in db as well as front-end code

    I changed in db as LIKE companyname || '%'

    but in the front end first I need to declare a variable ,and check the value exists in company name or not and make sure that null or not using if else statement.
    how to write the code?

    my idea is
    int index = 0;
    index = comp.companyname indexof (',');
    companyname.substring(index,0)

  2. #2
    Join Date
    Mar 2013
    Posts
    6

    Re: concatenation of string and assigning to a varibale

    Hi,

    You ca use this to get the first value of that string.

    Code:
    string[] splittedString = yourString.Split(',');
    string firstPart = splittedString[0];

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured