Delete in a string

I need to send the following string to my serial port:   AT+BT!<del>!   where <del> is the backspace key
How would I send the 'backspace' as described ?
Thanks,
Morné

Concatenate a string constant to the string.  Set the representation of the constant to Hex display.  Put the value 08 into the string constant.
Message Edited by Ravens Fan on 07-31-2007 10:47 AM
Attachments:
Backspace.png ‏2 KB

Similar Messages

  • Urgent: deleting a specific string form an existing .txt file

    Plz help me with a sample code on how to delete a specific string form an existing .txt file..it is very urgent...
    thanks in advance

    String path = "D:\\text.txt";
    File file = new File(path);
    BufferedReader br = new BufferedReader(new FileReader(file));
    String line = "";
    String text = "";
    while((line = br.readLine()) != null) {
    text += line + "\n";
    br.close();
    String textToFind = "find";
    int start = text.indexOf(textToFind);
    if(start != -1) {
    text = text.substring(0, start) + text.substring(start + textToFind.length());
    BufferedWriter bw = new BufferedWriter(new FileWriter(file));
    bw.write(text, 0, text.length());
    bw.close();
    }

  • Delete char from string

    hi,
    i have field like that 12-3456
    and i wont to delete '-'  to have 123456
    what is the best way to do that?
    Regards

    Hi,
    TRANSLATE field USING '- '.
    CONDENSE field NO-GAPS.
    The TRANSLATE command replaces al '-' with blanks and the CONDENSE, NO-GAPS compresses the string to remove all spaces/blanks.
    Cheers,
    Aditya

  • How to delete Spaces in String

    Can somebody help to modify my source, cos i want to delete certain space. Thanks
    private static String printStar(int SpaceForStar){
        String sDelOneSpace =" ", sAddOneSpace=" ", star ="*", sTtlSpace ="";
        for(int i=0; i<numSpace; i++){
          sTtlSpace += sAddOneSpace;    
        for(int i =0; i<8; i++){
          sTtlSpace = sTtlSpace - sDelOneSpace;   // seem that not working.. can somebody help Thanks
        return sTtlSpace+star;
      }Thanks in advance
    jas

    What you are trying to do will not work - subtraction of Strings does not make any sense.
    To remove spaces, I suggest you use a StringTokenizer with space as dividing token. Lop trough the tokens and add them to a new String, like this:
        public static void main (String[] args) throws Exception {
            String withSpace = "aaa sss bbb";
            System.out.println(removeSpaces(withSpace));
        static String removeSpaces(String withSpaces) {
            java.util.StringTokenizer t = new java.util.StringTokenizer(withSpaces, " ");
            StringBuffer result = new StringBuffer("");
            while (t.hasMoreTokens()) {
                result.append(t.nextToken());
            return result.toString();
        }This will remove all spaces, and print "aaasssbbb". If you only want to remove the first or the last space, you can use indexOf() or lastIndexOff to find the space, and then substring to pick the text before and after that space and concatenate those two strings to a new string without the space:
        static String removeFirstSpace(String withSpaces) {
            int spaceIndex = withSpaces.indexOf(' '); //use lastIndexOf to remove last space
            if (spaceIndex < 0) { //no spaces!
                return withSpaces;
            return withSpaces.substring(0, spaceIndex)
                + withSpaces.substring(spaceIndex+1, withSpaces.length());
        }

  • Oopppss!!!! Deleted SMS test string andwant it back. No recent backup - Help!!

    I recently deleted an SMS message string and would like to get it back.  Not backed up.  Does the delete physically removed it from memory or does it simply remove the database pointers to it.  Any utilities that could be used?
    Post relates to: Treo 700p (Sprint)

    Hi..  Welcome to the Palm forums.  If you deleted a text msg string then it's like any computer data that is deleted. The pointers are deleted and it can no longer be seen. I would think that it can be recovered if you have the right utility to recover data and/or know how to do that.  FileZ is a good utility for palm os however I do not believe it will find files that have been deleted.  You would probably need to take the device to a data recovery specialist which would be rather expensive. 

  • Bash: delete phrase from string

    Hello Community,
    I have a string of words, "hello my name is batman", and i want to delete my name is from the string. I want to automate this process so that I can use it with other strings (ie. "hello my name is Robin"), but i don't want to be cutting characters because it is a different amount of characters for each one (it's obviously not as simple as "hello my name is..."). Thank you so much.

    The OP wants to delete 'batman', or any name after "is ", so:
      echo "hello my name is batman" | sed 's/\(hello my name is \).*/\1/'
    This will work on any name:
      echo "hello my name is Robin" | sed 's/\(hello my name is \).*/\1/'
    Tony

  • To delete first and last character of a string???

    Hi Everybody !!!
    Do you know a method that can permit to delete in a string the first and the last character?
    For instance I have in my string this word : [the word]
    I would like to delete the '[' and the ']' character.
    Is exist a method that permit to delete this character?
    Thanks !!!

    Look at the substring method of the String class.
    Note that since string is immutable, you'll need to assign the results of substring to a variable (could be the same as the original or different).

  • Take and delete a String from another String

    I have original input string= 111100001111
    I need to Take for example the least 4 bits .... Output= 1111
    and to be removed from the original input string so the original input string= 11110000 
    I am trying to make a generic one but the point is that I can not delete subset that I take from the original input String.  
    How can I take and delete from a string in the same time? 
    Solved!
    Go to Solution.

    Something like this?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Split String.png ‏13 KB

  • Problems deleting a string from an external file.

    hi!
    I am working on a program but am having problems deleting a string of information from an external file. The code I have managed to do only seems to be deleting the surname. The rest of the string remains and the Surname from the string bellow the one that should have been deleted moves to where the surname that was just deleated was.
    this is the code snippet that should be deleting the string:
              System.out.print("Please enter the last name of the contact: ");
              last_name = dataInput.next();
              int z = 0;
              for (int i=0; i < number_of_records; i++)
                        if ((last_name.compareTo(lastName)) < i && (last_name.compareTo(lastName[i]) > i))
                                  z = i;
              for (int i = z; i < number_of_records; i++)
                        lastName[i] = lastName[i+1];
    Anyone got any ideas why its not deleting the whole string?
    the extrenal file is set out like:
    surname,,first name,,phone number

    I don't think you have given enough information to answer this question completely; however, here is my guess:
    The code that appears to be doing the "deleting"
    for (int i = z; i < number_of_records; i++)
        lastName[i] = lastName[i+1];
    }is only acting upon the lastName array.

  • ChnAreaDel deleting wrong rows in a string channel

    I am trying to write a script in DIAdem 2010 SP1 to delete the first row of a group that contains two string channels and one time channel, but the
    wrong data is being deleted from the string channels.
    I start with a file that contains a group like this:
    I run this code expecting the first row to be deleted
    Dim logGroup
    Set logGroup = Data.Root.ChannelGroups("Log")
    Call ChnAreaDel(logGroup.Channels("Name"),1,1)
    Call ChnAreaDel(logGroup.Channels("ID"),1,1)
    Call ChnAreaDel(logGroup.Channels("Timestamp"),1,1)
    but end up with this:
    The first row of the Timestamp channel is deleted, but the Name and ID channels get their last rows deleted.
    I have played around a bit and it seems to me that for a string channel ChnAreaDel only deletes from the last row.
    Is there another function I should use? 
    Any help would be appreciated. 
    Thank You,
    Joe
    Solved!
    Go to Solution.

    Hi Joe,
    I've reproduced that ChnAreaDel()  bug you reported in both DIAdem 2010 and 2011-- really odd.  In the meantime, you can use this older approach that uses a string parameter to point to the channel collection to remove the row(s) from:
    Set logGroup = Data.Root.ChannelGroups("Noise data results")
    ChnStr = ""
    FOR Each Channel In logGroup.Channels
    ChnStr = ChnStrAdd(ChnStr, Channel.Properties("Number").Value)
    NEXT
    Call DataBlDel(ChnStr, 1, 1)
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Help with deleting multiple strings from file.......

    I am trying to delete the same string that may appear multiple times in the file. Here is the output to the screen. Here is the code. I have been researching the delete method it says that I have to start at an index position in the string but how would I find out where the multiples strings reside in the file? I am getting the feeling that it won't work for my purpose..???? I am trying to delete all ot the strings "a string of data3" from the file.
    Output
    C:\TestRead>java StringDelete
    Temp String file_data-------- a string of data3a string of data2a string of data
    1a string of data3a string of data2a string of data1a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    Code:
    import java.io.*;
    public class StringDelete
    public static void main(String [] args)
    try
    FileInputStream fis = new FileInputStream("TestFile.txt");
    DataInputStream in = new DataInputStream(fis);
    StringBuffer file_data = new StringBuffer();
    while(in.available() > 0)
    String temp = in.readUTF(); // read in a string from the file
    file_data.append(temp); // append it to the buffer
    System.out.println("Temp String file_data-------- " + file_data);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    boolean keepGoing = true;
    while(keepGoing)
    String toDelete = file_data.substring(0, "a string of data3".length());
    System.out.println("String toDelete-------- " + toDelete);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    if(toDelete == null || toDelete.equals("") )
    keepGoing = false;
    else
    file_data.delete(0,"a string of data3".length());
    catch(IOException e)
    e.printStackTrace();

    Here is the output. I am trying to get each part to work before I go on to the next part that is why some code is commented out.
    I need help to know why string "a string of data3" is not deleted in the towrite string??
    Output:
    C:\TestRead>java NewStringDelete
    String v after remove [ &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1
    &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data3]
    String towrite after remove &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of
    data1 &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data
    3
    Code:
    import java.util.Vector;
    import java.io.*;
    public class NewStringDelete
         public static void main(String [] args)
              //String ls = System.getProperty("line.separator");
              //File file;
              Vector v=new Vector();
         try{
              BufferedReader br=new BufferedReader(new FileReader ("TestFile.txt"));
              String s;
              while ((s=br.readLine())!=null)
                   {v.addElement(new String(""+s));}
                        br.close();
         catch(IOException e)
                   e.printStackTrace();
    /*now you have a Vector containing String objects..*/
         String remove = ("a string of data3");
         String towrite="";
    System.out.println("String v after remove " + v);     
         for (int i=0; i<v.size();i++)
              String ss = (String)v.elementAt(i);
              if (ss.equalsIgnoreCase(remove)){continue;}
              //     towrite=towrite+ss+ls;
                   towrite=towrite+ss;
    System.out.println("");               
    System.out.println("");               
    System.out.println("String towrite after remove " + towrite);                    
    /*do filewrite*/
    //try{
    // FileWriter fw=new FileWriter(TestFile.txt);
    // fw.write(towrite);
    // fw.close();
    // catch(IOException e)
    //               e.printStackTrace();

  • String not flushing

    I am reading in several urls from the console and writing them to a text file, however when i view the file i have several copies of data, i dont think i am flushing the writter correctly. Here is the code snippett.
    while(i!=0){
                     System.out.println("enter url:"+ i);
                      String url = bufferRead.readLine();
                      URL go = new URL(url);
                       BufferedReader in = new BufferedReader(new InputStreamReader(go.openStream()));
                       while ((inputLine = in.readLine()) != null)
                            text.append(inputLine);
                            in.close();
                            int beginRow = text.indexOf("<td>");
                            newtext = text.delete(0,beginRow);
                            int endofRow = newtext.indexOf("<tr>");
                            newtext = newtext.delete(0, endofRow);
                            // delete end of table to end of file
                            int tablend = newtext.indexOf("</tbody>");
                            int pageLength = newtext.length();
                            newtext = newtext.delete(tablend,pageLength);
                           String newtext2 = newtext.toString();                                   // cast newtext to string
                             String Test= newtext2.replaceAll("<a\\b[^>]*href=\"[^>]*>",""); // remove first part of href
                             String Test2= Test.replaceAll("</a>","");                       // remove lower case end of href      
                             String Test3= Test2.replaceAll("</A>","");                      // remove upper case end of href      
                             String Test4= Test3.replaceAll(",", "");
                            //System.out.print(Test3);               // test string to check all <\a> tags removed
                            Pattern p = Pattern.compile("<td>([^<]*)</td>");  // retrieve all text between td tags
                           Matcher m = p.matcher(Test4);
                           int t = 0;
                           while(m.find())
                               t++;
                             // get the matching group
                             String codeGroup = m.group(1);
                             // print the group
                          // System.out.format("%s",codeGroup);
                           //System.out.print(",");
                           writer.append(codeGroup);
                           writer.append(",");
                           writer.flush();
                           if(t == 15){
                                //System.out.println("");
                                writer.append("\n");
                                 t = 0;
                     i = i -1;
    {code}
    \any help greatly appreciated
    Edited by: 799317 on 01-Oct-2010 02:46                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    why would you think the input stream is a problem? You read until it is empty.
    I am going to be a bit not solving you problem here but....
    1) please indent properly and consistently.
    2) while not required brackets are a very good thing for code clarity.
    Why do you think the flush is not occurring?
    It appears you have commented out lines of code to validate you actually have data to put out, but you do not state that you have run with it and that it has valid output.
    Are you sure you want group(1) and not group()?

  • How to remove "\r" from a string

    I have a string, it has "\r" and "\n" eg : "abcde dfs \r \n acdsa \r\ncdaacdla"
    when I display this on a panel or print from panel, a box appears at the end, I think its because of \r characters.
    Is there any easy way to remove them.?
    please help thanks.

    sorry i dont which other replace you are talking
    about....btw i am using 1.3.xDon't worry, you'll evolve someday ;~)
    Just dump it into a StringBuffer, and page through and delete manually.
    String removeRs(String string)
       StringBuffer b = new StringBuffer(string.length());
       for(int x = 0 ; x < string.length() ; x++)
          if(string.charAt(x) != '\r')
             b.append(string.charAt(x));
       return b.toString();
    }

  • Delete a line in the middle of a text file

    Hi, I want to delete a certain string line in the middle of a text file. How could I do this? Thanks.

    Got it. But instead of overwriting with spaces I only need to write the letter "b":
    try {
                                            RandomAccessFile acceso=new RandomAccessFile("F:/ArchivoContrase�as.txt","rw");
                                            String linea="";
                                            while ((linea = acceso.readLine()) != null) {
                                                      StringTokenizer patron=new StringTokenizer(linea," ;");
                                                      String s=patron.nextToken();
                                                      s=patron.nextToken();
                                                      if (elimina.equals(s)) {
                                                           System.out.println(acceso.getFilePointer());
                                                           acceso.seek(acceso.getFilePointer());
                                                           acceso.writeBytes("b");                         
                                       } catch (FileNotFoundException e) {
                                            e.printStackTrace();

  • Can I restore deleted keywords in Bridge CS5?

    I accidentally deleted a long string of keywords in Bridge and I don't even remember what they all were. Any way to get them back?

    Not that I know of.  HOWEVER, if you did not delete the keywords on the photos, when you visit a folder with those deleted keywords it will write them back to the list.  If they are itacalized, they are temporary, or right click on them and choose persistent.
    The filter tab should show you what keywords are the current folder.

Maybe you are looking for