To find the count of a particular character inside a string

  • Dear All,

    I need to find the number of "~" present in a string. Is there any inbuilt function to do the same?? if not, can you please help me to achieving that?

    Pramod

  • Already Posted a solution...

    Declare @v-2 varchar(100)

    Declare @i int

    Set @v-2 = '12~12~~1234~13~~12~3~~'

    Select @i = Len(@v) - Len(Replace(@v,'~',''))

    Select @i

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

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

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