String Manipulation

Discussion in 'ASP .Net' started by Aaron, Dec 31, 2003.

  1. Aaron

    Aaron Guest

    1. How do I remove non-alphanumeric characters?
    Input: dEFD&*fdff/df;
    output: dEFDfdffdf

    2. How can I capitalize the first character of a word?
    Input: remember
    Output: Remember

    Thanks
    Aaron, Dec 31, 2003
    #1
    1. Advertising

  2. Aaron

    George Durzi Guest

    The answer to part 2 is ..

    sYourString.SubString(1).ToUpper();


    "Aaron" <> wrote in message
    news:...
    > 1. How do I remove non-alphanumeric characters?
    > Input: dEFD&*fdff/df;
    > output: dEFDfdffdf
    >
    > 2. How can I capitalize the first character of a word?
    > Input: remember
    > Output: Remember
    >
    > Thanks
    George Durzi, Dec 31, 2003
    #2
    1. Advertising

  3. Check out Regular Expressions - they rock! I don't have
    my reference material here, so I can't give you the exact
    code, but you can use Regular Expressions to do either
    one of these tasks in one, maybe two, lines of code. The
    first task would be something like strText =
    strTest.replace(/[^a-zA-Z0-9]/g, "") in JavaScript and
    something very similar in VB.NET or C#. (Also, I think
    there's a shortcut for [^a-zA-Z0-9] that refers to
    alphanumeric characters.) Use the symbol for a Word
    Boundary on your second task.

    >-----Original Message-----
    >1. How do I remove non-alphanumeric characters?
    >Input: dEFD&*fdff/df;
    >output: dEFDfdffdf
    >
    >2. How can I capitalize the first character of a word?
    >Input: remember
    >Output: Remember
    >
    >Thanks
    >.
    >
    Dave Davidson, Dec 31, 2003
    #3
  4. Here's VB code for removing non-alphas:

    strStuff = System.Text.RegularExpressions.Regex.Replace
    (strStuff, "^.*[^A-Za-z0-9].*$", "")


    >-----Original Message-----
    >1. How do I remove non-alphanumeric characters?
    >Input: dEFD&*fdff/df;
    >output: dEFDfdffdf
    >
    >2. How can I capitalize the first character of a word?
    >Input: remember
    >Output: Remember
    >
    >Thanks
    >.
    >
    Dave Davidson, Dec 31, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jared in ecs

    Perl string manipulation

    jared in ecs, Oct 22, 2003, in forum: Perl
    Replies:
    2
    Views:
    800
    Roy Johnson
    Oct 22, 2003
  2. Garfield

    String Array Manipulation Problem

    Garfield, Aug 27, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,801
    Michael Lang
    Aug 27, 2003
  3. Aaron

    Advanced String Manipulation (C#)

    Aaron, Jan 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    806
  4. Chris

    String manipulation

    Chris, May 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    441
    Pete Wright
    May 24, 2004
  5. mark

    string manipulation

    mark, Apr 27, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    341
    =?Utf-8?B?QnJhZCBRdWlubg==?=
    Apr 27, 2005
Loading...

Share This Page