actively remove unwanted characters

Hi, I am writing a function to actively remove unwanted characters from an input field. It will run each time a key event occurs on the selected input fields. It will remove the quotes and things like that. That's what I have so far...

void test(){
    char unwantedCharSet[50]={"abcD"};
    char tempString2[200];
    int matchedCharIndex;
    GetCtrlVal (panelHandle[MAIN], MAIN_STRING,tempString);
    do{
        RemoveSurroundingWhiteSpace (tempString);
        matchedCharIndex = strcspn (tempString, unwantedCharSet);
        if(matchedCharIndex==strlen(tempString)){
            SetCtrlVal (panelHandle[MAIN], MAIN_STRING, tempString);
            return;
        }
        else{
            strncpy (tempString2, tempString, matchedCharIndex);
            CopyString (tempString, matchedCharIndex, tempString,matchedCharIndex+1,(strlen(tempString)-matchedCharIndex));
            strcat (tempString2, tempString);
        }
        sprintf(tempString,"%s",tempString2);
    } while(1);
return;
}

It's still glitchy. Does anyone have advice to do this effectively?

Thanks in advance!

It was my solution, though, it takes a long time to perform. Someone has any advice on a better approach (more fast/cleaner)?

/*=====================================================================*/
//  TEST
/*=====================================================================*/
void test(){
    GetCtrlVal(panelHandle[MAIN],MAIN_STRING,tempString);
    SetCtrlVal(panelHandle[MAIN],MAIN_STRING,filter(tempString,unwantedCharSet));
return;
}
/*=====================================================================*/
//  FILTER
/*=====================================================================*/
char *filter(char *inputString,char *filterString){
    int ptr=0,matchedCharIndex=0;
    char outputString[100];
    do{
        matchedCharIndex = strcspn (inputString,filterString);
        if(matchedCharIndex!=strlen(tempString)){
            strcpy (outputString, inputString);
            for(ptr=matchedCharIndex;ptr<=strlen(inputString);ptr++){
                outputString[ptr]=inputString[ptr+1];
                DebugPrintf("%s\n",outputString);
                if(outputString[ptr]=='\n'||outputString[ptr]=='\0')
                    break;
            }
            strcpy(inputString,outputString);
        }
        else
            return inputString;
    } while(1);
return inputString;
}

Tags: NI Software

Similar Questions

  • How to remove unwanted characters in ODI Flatfiles

    Hi Experts,

    Can someone please explain, how to remove unwanted characters from flat files before moving on to the target? Your help will be greatly appreciated. Thanks in advance.

    Kind regards

    REDA

    On oracle staged you can use REGEX_REPLACE to get rid of special characters, for example

    REGEXP_REPLACE (, "[^ [: alnum:]" "]', NULL")

    or

    REGEXP_REPLACE (, "[[: cntrl:]] ','") to get rid of nonprinting characters

    In ODI 11.x you would put this in the field of the expression of the target model in your interface

    The ODI 12, you would use a component of the expression in your mapping

  • Removing unwanted characters.

    Dear friends,

    In our application, user to copy a document and pasting data into a field "comments".

    If this data is what either as bullets, arrows of the word document. Below is the insertion of the junk in the database as characters.

    a ¢ Analysys
    a ¢
    a ¢ now
    a ¢ when
    a ¢ as
    a ¢ us

    donâ t know how much he loves sthe testinga I'm not crazyha


    "' I'm a wear i ' i ' i ¨

    ¨ i

    i ¼ Uu
    i ¼ Yy
    i ¼ tt


    Now the user asking to remove all those unwanted characters in the comments column. Help, please!

    Published by: San Reddy on May 31, 2010 18:09

    Published by: San Reddy on May 31, 2010 18:18

    Try to use REGEXP_REPLACE(str,'[^[a-z,A-Z,0-9,[:space:]]]*','') you can watch the regular Expression and the include/exclude the character according to your wish.

  • How to remove unwanted applications?

    How to remove unwanted applications?

    georgeintexas wrote:

    How to remove unwanted applications?

    Hello

    What is your device? You cannot delete certain built-in apps (which they how earn money), for other applications, normally use can try:

    • Tap Settings,
    • Touch applications
    • Touch the app you wish to uninstall
    • Touch uninstall

    Still, you can't uninstall a lot of apps.

    Kind regards.

  • How can I manually remove unwanted/empty icons/fonts on my desk?

    How to manually remove unwanted/empty icons/fonts from my office? on windows vista

    Restart your computer when it starts up. Click on the start icon on the lower right. Click on the right side to slide the mouse to explore and click on find program files click on what program you had uninstalled.  If you find one remove it.  If it does not work. then try everywhere the same, except click ProgramData click what program you had uninstalled.  If you find one remove it.  If it does not work.  Try to download the program for free cleaner: http://www.filehippo.com/download_ccleaner or http://www.piriform.com/ccleaner/download after Setup click the record icon to clean.  This can work like I did before.  Hope you find it useful.

  • How to remove unwanted contacts in my contacts list in Livemail

    Original title: removal of unwanted in livemail contacts.

    How to remove unwanted contacts in my contacts list in Livemail

    Right click on them, then choose Delete.

  • How to disable/remove unwanted in ISE 1.1.1 language models

    We use the portal Sponsor/comments of EHT function.

    We have customized the English language model by default.

    But we do not want to translate/customize all models of default language.

    How can I disable/remove unwanted models? (The button Delete is disabled for them)

    Our users would be able to select models that are not customized.

    Hello

    You cannot remove default language models.

    Thank you

    Sent by Cisco Support technique Android app

  • PC became slower after execution of 'Registry Easy' to remove unwanted registry files.

    I have windows 7. recently, I downloaded "Registry easy" to remove unwanted registry files to make my pc faster. registry cleaning has been a success, but I followed with "junk cleaner" functionality of this software. Now this function is supposed to be just to clean the "undesirable." After cleaning, most of the files are format .tmp. now I feel that my pc has become slower, I feel some files (perhaps .tmp) deleted wer of the Windows folder despite my de-selection of Windows files to ensure that they are not considered as spam before you run "clean of junk. also, I currently have a low disk space. RAM, etc work fine. so slows PC due to insufficient disk space or this cleaning? I will be grateful for your help.

    These registry cleaners are snake oil.  They do little or no good and can cause serious problems.  Regarding unwanted cleaners, there is a good one built into Windows 7, and we know it's safe.  If you click on start-> computer, then click on the C: drive and click Properties, you can then click the disk cleanup button and it will clean the junk files.

    Good luck.

  • Removes all characters except numbers

    Hi all

    I want to reformat to following phone numbers. As you can see it in what follows, I want to delete all characters except numbers and it does not start wirh 0 0 at the beginning of the f-number. And the length is 11. What do you recommend?

    (543) 456-35-50 = > 05434563550

    (555) 555-55-55 = > 05555555555

    (210) 111-11 / 11 = > 02101111111

    Thank you

    Hello

    3018678 wrote:

    Hi all

    I want to reformat to following phone numbers. As you can see it in what follows, I want to delete all characters except numbers and it does not start wirh 0 0 at the beginning of the f-number. And the length is 11. What do you recommend?

    (543) 456-35-50-online 05434563550

    (555) 555-55-55-online 05555555555

    111-11 / 11 (210)-online 02101111111

    Thank you

    To remove all characters except the 10 digits, you can use REGEXP_REPLACE

    REGEXP_REPLACE (str, '\D')

    To put a "0" at the beginning of the string (if it isn't already begin with a '0'), you can use REGEXP_REPLACE even once:

    REGEXP_REPLACE (REGEXP_REPLACE (str, '\D')

    , '^([^0])'

    , "0\1".

    )

    I don't think that there is a way to do both things wih a single integrated function call.

    There is a requirement on the length being 11?  What happens if that comes into conflict with one of the other requirements?  For example, if the string is already long of 11 characters, but does not begin with a '0', do you want to add a "0", which makes 12 characters?  What happens if the length, after removing the numbers no, is very small, say 1?  (You can use LPAD adds however many ' 0 s you need.)  If the length (after removing the numbers) is 12 or more?  What happens if the string does not contain any what numbers at all?

    If these things are questions, then post CREATE TABLE and INSERT statements for some examples of data, accurate results, you want that data, and explanations.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • How to remove special characters from the string using translate() without typing all special characters?

    Hi all

    I am trying to remove special characters without the help of regular expressions.

    translate (the column name or string,'!@#$ & * (* () _) * "" :} {?}) >? /, «, » ')

    I want to eliminate this manual process to give all special characters using a chr() or ascii() function.

    Please show me the way.

    Thanks in advance

    Similar to the solution of Michael...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, i like (select level 1 c from dual connect by level<=>
    3 less
    4 Select + 32 (level-1) double connect by level<=>
    5 less
    6 select + 58 (level-1) double connect by level<=>
    7 less
    8 select + 91 (level-1) double connect by level<=>
    9 less
    10. Select 123 + (level-1) from dual connect by level<=>
    11 less
    12. Select 255 double
    13            )
    14, ts as (select level r, substr (str, level 1) c
    15 t
    16 connect by level<=>
    17             )
    18, tf as (select row_number() (order for r) r
    19                    ,ts.c
    20 TS
    21 I join on (i.c = ascii (ts.c))
    22             )
    23 select replace (sys_connect_by_path(c,'!'),'! ') Str
    24 TF
    25 where connect_by_isleaf = 1
    26 connect r = prior r + 1
    27 * start with r = 1
    SQL > /.

    STR
    -----------------------------------------------------------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

    Or something as horrible as this...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, I like (select replace (sys_connect_by_path (chr (c), 'A'), 'A') as tr)
    3 of)
    4 select c, rownum r
    5 (select 32 + (level-1) as the double connection by level c<=>
    6                         union
    7 select + 58 (level-1) double connect by level<=>
    8                         union
    9 select + 91 (level-1) double connect by level<=>
    10 the union
    11. Select 123 + (level-1) from dual connect by level<=>
    12 union
    13. Select 255 double
    14 tri 1
    15                        )
    16                  )
    17 where connect_by_isleaf = 1
    18 log r = prior r + 1
    19 start with r = 1
    20            )
    21 select translate (str, 'A' |) TR, 'A') as str
    22 * t, I
    SQL > /.

    STR
    --------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

  • remove special characters

    Hello

    How to remove special characters except '-'',' '. " in a string.

    Database: 10g

    Thank you

    Hello

    For example, use the REGEXP_REPLACE

    REGEXP_REPLACE (str

    , '[^-,.]'

    )

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.

    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Remove unnecessary characters, space and channel numbers

    Oracle 11.2.0.1

    Windows

    I have data from the table like this:

    David Parker

    Robert Josh

    Hick 1/4

    John ' Fowler

    Bill.Gates

    Herman Patrick «»

    Andrew % Clark

    I want to delete all the numbers, special characters, more than one space between the words and make the correct name.  How can I remove extra characters from string.

    In fact, we get data that has sometimes special characters, including numbers and more spaces in name and it still creates a bad output query.

    Thank you.

    Or...

    SQL > t

    2 ALSO (SELECT "David Parker' DOUBLE str")

    3 UNION ALL

    4. SELECT 'Robert Josh' DOUBLE

    5. ANY TRADE UNION

    6. SELECT ' Hick' 1/4 OF the DOUBLE

    7 UNION ALL

    8. SELECT q ' [John 'Fowler'] ' FROM DUAL

    9 UNION ALL

    10. SELECT 'Bill.Gates' FROM DUAL

    11 UNION ALL

    12. SELECT q'[Herman 'Patrick']' FROM DUAL

    13 UNION ALL

    14 SELECT q'[Andrew % Clark]' FROM DUAL)

    15 SELECT regexp_replace (str, "[^ A-Za-z] + ',' '") final_str

    16 FROM t

    17.

    FINAL_STR

    -----------------------------------------------------------

    David Parker

    Robert Josh

    Hick

    John Fowler

    Bill Gates

    Herman Patrick

    Andrew Clark

    7 selected lines.

    SQL >

  • Function to remove special characters in a column.

    Hi all

    In one of my column, we get special characters, as well as others. The data are extracted and loaded through Informatica. We are not face any problem while loading into the target, but when we try to extract these data through the report, it fails with the error:

    ORA-29275: partial multibyte character sets

    When we check this column, we find the special characters. Initially, we have implemented logic with the CHR to replace these NULL values. But every time we get different values. To make the permanent solution, we decided to remove all characters except available on Board of the key.

    Now, to this end, I need to write a function in Oracle's PL/SQL. I do not know more easy way from there to achieve. If I go with the CHR() function, I have to write for all these characters, which I think is not the right solution.

    Enjoy, if someone can help me identify the function or the way to get there.

    Thanks in advance.

    Hello

    AceNovice wrote:

    ... we have decided to remove all characters except available on key board...

    It depends on your keyboard.

    All that is on the keyboard you, something similar to this shoud work:

    REGEXP_REPLACE (string_column

    , '[^]0-9A-Za-z~!@#$%^&*()_+`={}| [\:";'' <>?,./-]'

    )

    This will return a copy of string_column, but with all the characters that are not not in the 2nd deleted argument.

    [Inside the brackets, ']' must come first (immediately after the ' ^') and '-' must come last.

  • How use Bridge to rename the batch to remove all characters after the 32nd character?

    I would like to batch rename to remove all characters after the 32nd character. Is this possible?

    Substitution string use with use of regular expressions is selected.

    In the use of the search field

    ^(.{32})(.*)
    

    In the field using replace

    $1
    
  • Remove unwanted background does not

    To use the images on PowerPoint, I often remove unwanted background of the image.  In order to make sure that the image is on a Word with layer 0.  I then select a mask.  To ensure that I have on the mask and use the brush etc. to add to the mask the bits I want to delete.  The selection shows to remove black-and-white authorization (or catering areas I wrongly deleted). That's how I used it in the past with no problems.  Now, the selection mask shows gray and he is only partially remove the background.  It's it's doing sort of transparency.  I don't remember making any selection as.  I do not see how to restsore the normal selection mask black, which removes all the unwanted image part.

    Hello

    USE shortcuts

    D - for default

    X - to switch between foregorund and background color

    and then apply your selection.

Maybe you are looking for

  • I get an error message that I can't find on the internet?

    Whenever I try to use my firefox browser to open certain Web pages (like connect to instagram, or using my net banking income, or playing videos on instagram...) this thing is. The address was not included Firefox doesn't know how to open this addres

  • Satellite Pro P300D-21F - how I wake up from hibernation?

    How do I wake up? tried the mobile mouse by pressing different keys. If you press the power button / stop watch computor message was not closed properly.

  • Problem with a Toshiba PX1267E 320 external drive

    Hi all I have a problem with a Toshiba px1267e 320 external drive, when everything was ok with it I would like to move on and the blue led would come and change blue /violet as it was found on my laptop, a small vibration could be felt if I handled t

  • Re: Satellite L550-13V - webcam number - yellow stars instead of my image

    Hi all I have a toshiba Satellite L550 13V and everything works perfectly for a year and a half now.Recently, I wanted to use the webcam via Skype and it did not work. In fact, it is the webcam itself that can not pinpoint my face.When I see in the D

  • must catch the error timeout counter usb-6221

    I'm programming an application that will be BOUNCING entered.  What I need to do, this is the time-out to trap "error-200474 occurred at DAQmx Read (counter DBL 1Chan 1Samp) .vi:1" rather than to have to stop the program. How can I do this?