Find the Number of times a '¯'character appears in a string.

Hi,
In my staging table I am having data like below
ABL¯ABL¯0¯0¯ABL¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ 
ABL¯ABQ¯480¯825¯DLS¯AMA¯ABQ¯ ¯ ¯ ¯ ¯ ¯ ¯ 
ABL¯ACD¯808¯1255¯DLS¯ELP¯TCS¯PHX¯ACD¯ ¯ ¯ ¯ ¯ 
ABL¯ADE¯1256¯471¯DLS¯AMA¯ABQ¯LSV¯ADE¯ ¯ ¯ ¯ ¯ 
ABL¯AFT¯1140¯1744¯DLS¯LAX¯FON¯AFT¯ ¯ ¯ ¯ ¯ ¯ 
ABL¯AHM¯1178¯1637¯DLS¯LAX¯AHM¯ ¯ ¯ ¯ ¯ ¯ ¯ 
ABL¯ALB¯1769¯1825¯DLS¯WIL¯ALB¯ ¯ ¯ ¯ ¯ ¯ ¯ 
ABL¯ALE¯1041¯1150¯DLS¯ALE¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯
Now I want to find the Number of times a '¯'character appears in a string.
I should get output 14
thanks & regards,
Vipin Jha
Thankx & regards, Vipin jha MCP

Hi Vipin,
You can try below sql code also
code:-  len(data)-len(replace(data,'¯','')) -(len(data)-len(replace(data,' ','')))
select data,len(data)-len(replace(data,'¯','')) -(len(data)-len(replace(data,' ',''))) CountofCharacter from
select 'ABL¯ABL¯0¯0¯ABL¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ' data
UNION
SELECT 'ABL¯ABQ¯480¯825¯DLS¯AMA¯ABQ¯ ¯ ¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯ACD¯808¯1255¯DLS¯ELP¯TCS¯PHX¯ACD¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯ADE¯1256¯471¯DLS¯AMA¯ABQ¯LSV¯ADE¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯AFT¯1140¯1744¯DLS¯LAX¯FON¯AFT¯ ¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯AHM¯1178¯1637¯DLS¯LAX¯AHM¯ ¯ ¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯ALB¯1769¯1825¯DLS¯WIL¯ALB¯ ¯ ¯ ¯ ¯ ¯ ¯ '
UNION
SELECT 'ABL¯ALE¯1041¯1150¯DLS¯ALE¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯'
) t
Thanks
Prasad

Similar Messages

  • Calculate the number of times a character appears in a string

    Please help.
    Is there a way to count a number of occurences of a particular character in a string? e.g. If you have 'DATABASE' as a string, can you calculate the number of times 'A' occurs in it? The answer is supposed to be 3, but can you calculate it in Oracle?
    Thanks in advance.

    Re: Any built-ins for occurance

  • Count the number of times a character is in a string using pl/sql

    I need to count the number of times ":" appers in the string ":XXX:CCC:BBB:".
    I have sound some solution using SQL but I do not want the context switch.
    Also I am on 10g so I can not use REGEXP_COUNT.
    Any help would be great.

    Hi,
    length(REGEXP_REPLACE(':XXX:CCC:BBB:','[[:alnum:]]'))counts all kinds of punctuation, spaces, etc., not just colons. Change any (or all) of the colons to periods and it will still return 4. Use '[^:]' instead of '[[:alnum:]]' if you really want to count just colons.
    Also, "SELECT ... FROM dual" is usually needed only in SQL*Plus or similar front end tools. In PL/SQL, you can call functions without a query, like this:
    x := NVL (LENGTH (REGEXP_REPLACE (txt, '[^:]')), 0);

  • Find the number of times a word appears

    In Google Chrome find/search (ctrl+F) it will tell you how many times the word you are finding appears.
    In Firefox I know you can find things (also ctrl+F) but is there any way in which you can find how many times that word appears, like in Chrome.

    Any help please, anyone?

  • How to find the number of times method being called.....

    hi,
    can any one pls tell me how to find the number of times the method being called......herez the example....
    Refrence ref = new Refrence();
    for(int i = 0;i < arr.length; i++){
    if(somecondition){
    ref.getMethod();
    here i want to know how many times the getMethod() is calling...Is there any method to do this.. i have seen StrackTraceElement class..but not sure about that....pls tell me the solution....

    can any one pls tell me how to find the number of times the method being called......
    herez the example.... http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • Program to count the no. of times a character occurs in a string.

    program to count the no. of times a character occurs in a string.
    Say if u have a method :- Countclass(string s,char c) then using this u should be able to count a char ' T' in the string ="TESTING".
    So it is appering 2 times.
    How to count it.

    int countChar(String s, char c) {
       int count = 0;
       for (int i=0; i<s.length(); i++) {
          if (s.charAt(i) == c)
             count++;
       return count;
    }

  • How do I count the number of times a word appears in a column?

    What I have is a spreadsheet logging work history. Let's say the work location is "office", "home", or "travel" and I want to have a separate cell in another table for totals, count up the number of time each appears in the data for the year. So it would look like this:
    Date
    Location
    sept 1
    office
    sept 2
    home
    sept 3
    home
    sept 4
    travel
    sept 5
    office
    sept 6
    office
    sept 7
    office
    sept 8
    travel
    sept 9
    home
    sept 10
    office
    Totals
    Days
    10
    Office
    5
    Home
    3
    Travel
    2
    I just can't figure out how to develop the formula to put in the Totals column to make it work this way. If you can help me achieve this I'd really appreciate it!

    Hi SpartanAntarctican,
    Table 1 to record your locations
    Date
    Location
    sept 1
    office
    sept 2
    home
    sept 3
    home
    sept 4
    travel
    sept 5
    office
    sept 6
    office
    sept 7
    office
    sept 8
    travel
    sept 9
    home
    sept 10
    office
    Table 2 to sum your locations
    Totals
    Days
    10
    Office
    5
    Home
    3
    Travel
    2
    In Table 2 the formula in B2
    =ROWS(Table 1::A)−1
    Minus 1 because there is a Header Row in Table 1.
    In Table 2 the formula in B3 (and Fill Down)
    =COUNTIF(Table 1::B,A3)
    You can check this by adding 5 + 3 + 2 to arrive at 10
    Or maybe delete Row 2 put the Days calculation into a Footer Row in Table 2
    =SUM(B) .
    Regards,
    Ian.

  • Can I find the number of times the recorded meeting has been viewed?

    In Adobe Connect is it possible to find the number of views after a recorded meeting is made public? Under meeting dashboard it keeps track of these views for 30 days but I can not seem to find anywhere under the reports where this information is located.

    If you move the recordings to the Content Library, then you can pull the standard content reports for it, which will tell you number of views.

  • How to count the number of instances a record appears in a string

    I have a move that imports Name, Department and Site from an
    external CSV file, this part I managed to get working after many
    weeks. I would like to be able to count the number of instances of
    a specific Site “Glasgow” appears in the String. This
    way I know how many lines to set.
    Also can you add Dynamic text to a rollover button? I can get
    the the text to display on the root but not on a button.
    I am new to programming and Flash so apologies in
    advance.

    Those which took time to read carefully *_iWork Formulas and Functions User Guide_* are aware of the availability of wildcard characters.
    =COUNTIFI(range;"=text")
    will do the trick.
    Yvan KOENIG (VALLAURIS, France) lundi 26 avril 2010 17:36:34

  • Count the number of instances a record appears in a string

    I have a move that imports Name, Department and Site from an
    external CSV file, this part I managed to get working after many
    weeks. I would like to be able to count the number of instances of
    a specific Site “Glasgow” appears in the String. This
    way I know how many lines to set.
    Also can you add Dynamic text to a rollover button? I can get
    the the text to display on the root but not on a button.
    I am new to programming and Flash so apologies in
    advance.

    Hi,
    length(REGEXP_REPLACE(':XXX:CCC:BBB:','[[:alnum:]]'))counts all kinds of punctuation, spaces, etc., not just colons. Change any (or all) of the colons to periods and it will still return 4. Use '[^:]' instead of '[[:alnum:]]' if you really want to count just colons.
    Also, "SELECT ... FROM dual" is usually needed only in SQL*Plus or similar front end tools. In PL/SQL, you can call functions without a query, like this:
    x := NVL (LENGTH (REGEXP_REPLACE (txt, '[^:]')), 0);

  • How can i find the number of times my volume license has been activiated?

    Volume licensing activations.

    Try contacting Adobe support to see if they can help.
    Here are some links to help make contact:
    http://www.adobe.com/support/chat/ivrchat.html
    http://www.adobe.com/support/download-install/supportinfo/

  • Count number of times each char appears??

    Hi! I'm trying to figure out, how to count the number of times ech character appears in the text using ascii code??

    Go the text character-by-character, and count each character. It's that simple.
    The only remotely hard part is holding your character counters. You could use a Map.
    But if you know that the characters are always going to be ASCII, then there's only going to be 128 of them.
    So an array of int with 128 elements should be sufficient.
    Those are more than enough hints. Go do your homework now.

  • Generate numbers in incremental order, the number of times condition met?

    I have tried explaining my problem here also.
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=31&t=007531&p=1
    But trying to put in other words now.
    I have a NO tag which appears many times in xml. and alwyas have some random numbers displaying.
    output looks something similar to this
    something......<NO>1</NO>
    something......<NO>1</NO>
    something......<NO>2</NO>
    something......<NO>1</NO>
    something......<NO>3</NO>
    something......<NO>1</NO>
    something......<NO>5</NO>
    something......<NO>1</NO>
    something......<NO>1</NO>
    something...... & so on.
    Now instead of these numbers coming in this order i prefer to display in final output file as
    1 2 3 4 5 .................... n
    Is it possible in any ways using xslt.
    DO we need to ignore the values given in input file and then generate output values for same.
    it can be like the number of times NO tag appears in xml, it should start from 1 and keep increasing value by 1, until NO tag finishes appearance.
    But next time when other xml transforms it again should be able to start from 1 till n.
    is there a possibility of using java code for this situation or xslt is capaable enough to handle this.
    Thanks
    VJ

    I'm guessing you are looking for something like this. I used a pull approach but it could be done with a push (xsl:for-each).
    Sample XML
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <NO>1</NO>
         <NO>1</NO>
         <NO>2</NO>
         <NO>1</NO>
         <NO>3</NO>
         <NO>1</NO>
         <NO>5</NO>
         <NO>1</NO>
         <NO>1</NO>
    </root>
    Sample XSLT
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
         <xsl:template match="root">
              <output>
                   <xsl:apply-templates select="NO"/>
              </output>
         </xsl:template>
         <xsl:template match="NO">
              <row>
                   <xsl:value-of select="position()"/>
              </row>
         </xsl:template>
    </xsl:stylesheet>
    Sample Output
    <output>
         <row>1</row>
         <row>2</row>
         <row>3</row>
         <row>4</row>
         <row>5</row>
         <row>6</row>
         <row>7</row>
         <row>8</row>
         <row>9</row>
    </output>

  • Is there a way to count the number of times an array moves from positive to negative?

    I have an array of values, and I need to find the number of times that the array changes signs (from positive to negative, or vice versa). In other words from a graphical standpoint, how many times a certain line crosses the x-axis. Counting the number of times the array equals zero does not help however, because the array does not always equal exactly zero when it crosses the axis (ie, the points could move from .1 to -.1).
    Thanks for you help. Feel free to email me at [email protected] I only have lv 5.1.1 so if you attach any files, they cannot be version 6.0.

    Attached is a VI showing the # of Pos and Neg numbers in an array, with 0 considered as non-Pos. It is easily modifiable to other parameters - including using the X-axis value as your compare point versus only Zero.
    This is a modified VI from LV (Separate Array.vi)
    Compare this with your other responses to find the best fit.
    Doug
    Attachments:
    arraysizesposneg.vi ‏40 KB

  • How much times a word appears in a string?

    There is any function to find out how much times a word
    appears in a string?
    For example:
    mystring = "Mytext... text... contentext";
    There is any function to tell me that "text" appears 3 times
    in that string?
    I searched for function like that, but didn't found
    one.

    here's a method that seem fairly consistent using the
    string.split() method - the returned array will always have one
    more index than the places in which the string was split.

Maybe you are looking for