InitCap Function for multiline input.

  • Hi All,

    I want to convert my input in proper format. (initial latter capital.)

    Input:

    PRAVIN B PATEL

    UNIT: 9932.

    JAJEI 938, RUNYTE

    Output Should be:

    Pravin B Patel

    Unit: 9932.

    Jajei 938, Runyte

    Note: I have already tried function exists in article in this portal and also other web site. So, please do not post any link in answer.

    I found problem where there is a Enter in my input. for ex. (After Patel, i press enter, so it couldn't convert next line UNIT to Unit.)

    Thanks in advance for your help.

    Pravin Patel.

  • Firstly, I think it's important to point out that the database layer probably isn't the best place to implement this.

    Some general points:

    1) Forename, Surname and Address Lines should be held in separate database fields so you shouldn't really be dealing with carriage returns in the first place

    2) The input should be validated and the case corrected at time of input in your front end so this shouldn't be necessary.

    If you really must deal with it in this format, then I'd recommend breaking out into CLR to perform this work, especially if you're dealing with big text fields with multiple lines. If you're dealing with addresses in different formats than the example you've provided, is first letter capitilisation actually appropriate? E.g. in the UK, postcodes should be presented in UPPER CASE.

    What about special cases for capitilisation of names (e.g. Mc, de, la etc)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply