How to replace regex match into a char value (in the middle of a string)

Hi uncle_alice and other great regex gurus
One of my friends has a peculiar problem and I cant give him a solution.
Using String#replaceAll(), i.e. NOT a Matcher loop, how could we convert matched digit string such as "65" into a char of its numeric value. That is, "65" should be converted into letter 'A'.
Here's the failing code:
public class GetChar{
  public static void main(String[] args){
    String orig = "this is an LF<#10#> and this is an 'A'<#65#>";
    String regx = "(<#)(\\d+)#>";
    //expected result : "this is an LF\n and this is an 'A'A"
    String result = orig.replaceAll(regx, "\\u00$2");
    // String result = orig.replaceAll(regx, "\\\\u00$2"); //this also doesn't work
    System.out.println(result);

I don't know that we have lost anything substantial.i think its just that the kind of task this is
especially useful for is kind of a blind-spot in the
range of things java is a good-fit for (?)
for certain tasks (eg process output munging) an
experienced perl programmer could knock up (in perl)
using built-in language features a couple of lines
which in java could takes pages to do. If the cost is
readability/maintainability/expandability etc.. then
this might be a problem, but for a number of
day-to-day tasks it isn't
i'm trying to learn perl at the moment for this exact
reason :)Yes. And when a Java source-code processor(a.k.a. compiler) sees the code like:
line = line.replaceAll(regexp,  new String(new char[] {(char)(Integer.parseInt("$1"))}));or,
line = line.replaceAll(regexp,  doMyProcessOn("$1")); //doMyProcess returns a Stringa common sense should have told him that "$1" isn't a literal string "$1" in this regular expression context.
By the way, I abhor Perl code becaus of its incomprehensibleness. They can't be read by an average common sense. Java code can be, sort of ...

Similar Messages

  • How do I get back into my iPad after updating the iOS?

    how do I get back into my iPad after updating the iOS?

    What do you mean? Why can you not access the iPad?

  • How to convert Smart Form into PDF format and return the result in BAPI?

    I want to convert a Smart Form into PDF format and return the result in BAPI.
    can anyone tell me how it can be done with related example
    regards
    pranay

    hi,
    smart form to pdf--
    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
    DATA: p_output_options TYPE ssfcompop,
    p_control_parameters TYPE ssfctrlop.
    p_control_parameters-no_dialog = 'X'.
    p_control_parameters-getotf = 'X'.
    CALL FUNCTION v_func_name "call your smartform
    EXPORTING
    output_options = p_output_options
    control_parameters = p_control_parameters
    IMPORTING
    job_output_info = s_job_output_info.
    call function 'CONVERT_OTF_2_PDF'
    tables
    otf = s_job_output_info-otfdata
    lines = t_pdf
    and if u need more u can check below links also
    Check the below links..
    Re: Smartforms to PDF
    Re: smartform (otf) as pdf and sending as email-attachment
    VISIT THIS LINK
    Re: Smartforms to PDF
    PLZ REWARD POINTS IF IT HELPS YOU
    rgds
    anver

  • How use replace all grid row with variable value

    hi master
    sir i have master detail form
    in detail form i have 5 column grid thate have 25 row at time
    one column name id
    such as id have value 23
    but i want replace all id row with 555
    how i replace all id in grid with 555 befor commit_form
    how i use loop for grid
    or any other method
    please give me idea
    thank's
    aamir

    Go_Block('Detail');
    First_Record;
    Loop
      :detail.item := '...' ;
      Exit when :system.last_Record = 'TRUE' ;
      Next_record;
    End loop;
    First_Record ;Francois

  • I have taken pictures of items that are linked to a database that I am building.  How can I bypass importing into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    I have taken pictures with both my Sony camera and my iPhone of items that are linked to a database that I am building, as well as my website.  How can I bypass importing the images into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    If your Sony has a removable memory card you can use a card reader to copy the image files from to a folder on your Desktop and then move them anywhere you'd like.
    Since the iPhone doesn't have a removable memory card you can try using Image Capture to see if you can manually upload the files to a folder on the Desktop. 
    If you have to import the photos, which are image files, into iPhoto you can then export them out of iPhoto to the Desktop and go from there to your database.  Just because they are in iPhoto doesn't prevent you from using them elsewhere.
    OT

  • How do I get my google search bar back in the middle of my page insead of the Blank searh engine that is on my start up page now

    Before I did the last upgrade with Firefox, I had the Google search bar in the middle of my start page. Now , after the upgrade, my Google search bar is up on a tool bar at top of the page and the when you type something in the large Firefox box in the middle of the page does nothing even though it has the Search box to the right of it. The restore last session is under that. I just have a large box in the middle of start page that does nothing. I wish that was my Google search box again.

    ''Restoring Google Search page as the home page''
    What you are looking at on the web page is a '''search form''', not a search bar. Mozilla changed the default home page to '''about:home''' which is supposed to be faster because it is on your computer, but they piled on a few ornaments. There is a space which is essentially advertising space for Mozilla, or to tell you that you have a previous session available below the search form area.
    You can replace that page with a real Google Search page http://www.google.com which like other Google pages has links at the top to other Google applications and tells you if you are logged into Google such as for GMail.
    "Alt" > Tools > '''Options''' > General >
    :When Firefox starts: "Show my homepage":
    :Home Page: http://www.google.com
    :Press "Ok" at the bottom of the options window.
    Specific information on installing a home page is in
    :http://support.mozilla.com/en-US/kb/How%20to%20set%20the%20home%20page
    ''Some problems with terminology''
    The '''search bar''' is part of your toolbars and you can bring up any search engine you want in it.
    Google has their own "Google Toolbar" extension, which you would do well to avoid.
    The large empty space on the '''about:home''' default home page, is to tell you that you have a previous session available. You don't need that notification you can bring up your "Previous Session" from the History menu, and after that you can bring up previous windows (or all of them also from same History menu).
    In fact if you would like to see the notification at the end of your session, enabling you to restore your current tabs see item #31 (#tabslost) in the following: ...
    You can make Firefox '''Firefox 5.0''' look like Firefox 3.6.18, see numbered items 1-10 in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 5.0, or 4.0.1, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    ''If this answers your question please mark it as solved -- to remove from the unresolved problems.''

  • How to search two columns and return a value in the same row to a cell?

    Identification
    Diameter
    Soak
    3" Tank (inches/kft)
    AWG
    mils
    Code
    Strands
    Shield
    Conductor
    Insulation
    Semi-Con
    Days
    SD
    Injection
    Soak
    Total
    2
    175
    00
    7
    External
    0.288
    0.692
    0.752
    60
    0.4
    3.6
    20.0
    23.6
    2
    220
    00
    7
    External
    0.284
    0.764
    0.864
    75
    0.4
    3.6
    20.0
    23.6
    2
    260
    00
    7
    External
    0.284
    0.844
    0.944
    90
    0.4
    3.6
    21.8
    25.4
    2
    320
    00
    7
    External
    0.288
    0.964
    1.064
    110
    0.4
    3.6
    24.3
    27.0
    2
    345
    00
    7
    External
    0.288
    1.014
    1.114
    115
    0.4
    3.6
    25.6
    29.2
    Length
    3"
    4"
    AWG
    mils
    Soak
    SD
    Injection (3")
    Injection (4")
    650
    2
    320
    I want to input two values, AWG and mils and return the value in the Days column. 
    In the instance of what I am showing ....   AWG=2 AND mils=320 so Soak=110 ....
    I want to search the columns (AWG) AND (mils) to return a value in the column (Days) for that row into cell H10 (Soak)  ...
    So far I have toyed with LOOKUP, INDEX and MATCH ....

    SCW,
    I'm sure there is a clever way to cascade functions to avoid adding an auxiliary column in your practice table, but to me it wouldn't be worth the aggravation. I would add a column that concatenates Columns A & B, AWG & mils. This column can be anywhere and would be Hidden. Let's say your new column is Column N.
    In Column N, fill the body rows with:
    =A&"-"&B
    As good Numbers programming form would indicate, let's name the Practice Table Practices and only put the practices in that table. In another table where you do the lookup, let's call it Program, we will have the calculation/lookup.
    Based on your example, I'd guess that AWG may be in Column D and mils in Column E of your Program table, and the Soak lookup in Column F. If I'm wrong, adjust the column id.
    In Column F, write:
    =OFFSET(Practices::I$1,MATCH(D&"-"&E, Practices::N,0)−1, 0)
    The hyphen in the concatenated representation of the combination of AWG and mils is just tp make it more readable.
    As I'm sure you know, you could use other approaches, but since I had you put your aux column at the end of your Practices table, OFFSET with MATCH is a clean approach. INDEX could be used too.
    Here's an illustration:
    Regards,
    Jerry

  • How can I delete a caracter in the middle of a String ?

    Hello
    I get a string like "a-b-c".
    And I want to delete the caracter - .
    and the string will be abc !
    How can I do that ?
    Thanx

    if there are going to be a lot of dash characters you could read the string character by character, compare the value of the character with the range of values for a letter in ascii, and not copy it to a new string if it doesn't match. If the odd character out is only going to be a dash, you can search the string for the character, split the string at this point, append it to a string buffer and keep doing this till you're done. Just suggestions :)

  • How do i get rid of a scroll bar in the middle of everything?

    I have what "it" calls a black Scroll Bar in the middle of the screen.  How do I get rid of it?

    Can you take a screen shot and post t?
    Also, it is very hard for people to help when we don't know which of the many iMac variatnts you have was what version of the Mac operating system you are running. Also let us know if this is limited to a specific program or happens no matter what you are doing with the computer.
    A good place to start is with "About this Mac" from your Apple menu:

  • How do i get my message to not be in the middle..

    So i don't know what i did but my skype message are just in the middle i can't move it back... i redownload skype and look in settings how do i fix this? 
    Mod Edit: Edited post to comply with the Skype Community Guidelines and Skype Etiquette

    I firgured it out i had to get them to shake like i was deleling them then drag it it out of the category still have no idea how she managed to get them int here in the first place....thanks.

  • How can I set up tablet shortcut menu button for the middle button my X230T?

    I think I have a faulty X230T, there are now only three tablet buttons and the middle does not do anything. I have installed 7wg737.exe (tablet short menu for Win7), but it does nothing.
    When I go into Tablet PC setting>buttons, only one button shows up and that's the screen rotation button. 
    Is there a way to assign the middle button to shortcut menu? Otherwise I'm unable to change brightness or volumn during tablet mode which would make this tablet unusable.

    Hi Susan,
    Try Butler...
    http://www.versiontracker.com/dyn/moreinfo/macosx/20035

  • How to Create Pop up window and assign values to the table in it

    Hi All,
      I have a code which checks for duplicate value in the database and displays that duplicate record. I want to put the duplicate record value in a table of a popup window. Can you please tell me how do i acheive this?
    I tried the below code for creating a popup but most of the methods used here are deprecated. Please help
    IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
    "MyWindowName");
    // create the Window
    IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
    window.setWindowPosition(WDWindowPos.CENTER);
    window.setTitle("WindowTitle");
    // Save WindowInstance in Context
    wdContext.currentContextElement.setWindowInstance(window);
    // and show the window
    window.open();
    Regards
    Suresh

    Hi Suresh,
    "createModalWindow" is not a depricated method.
    Check this code.
    IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
              "SalesAreaWindow");
    //             create the Window
              IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
              window.setWindowPosition(WDWindowPos.CENTER);
              window.setTitle("Sales Window");
              window.setWindowSize(100,100);
    //             Save WindowInstance in Context
              wdContext.currentContextElement().setWindowInstance(window);
    //             and show the window
              window.show();
    "WindowInstance" is the context attribute of type "com.sap.tc.webdynpro.services.session.api.IWDWindow"
    Re: opening a new window on lead select in a table!!!
    Regards,
    Mithu

  • How do I get rid of a timer symbol in the middle of my screen ?

    Someone please tell me how to get rid of this timer symbol that stays in the middle of my screen ever since I installed the HP software for my Deskjet F2280 printer, this symbol still appears when I close the software and/or disconnect my printer and its really annoying at times and I thank anyone who helps me with this.
    This question was solved.
    View Solution.

    Zigglos, welcome to the forum.
    Here is an guide that may help solve your problem.
    Please click "KUDOS Thumbs Up" if I have helped you and click "Accept as Solution" if your problem is solved.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • How to make responsive Edge Animate with elements aligned in the middle?

    Hi,
    I wanted to create a responsive hero slideshow using Edge Animate. It will have a 100% width and max-height of 500px. However, I wanted that the other elements will stay in the middle of the slideshow and not be anchors to either corners - as what is selectable in Animate.
    My aim to to achieve something similar to Slider Revolution Responsive jQuery Plugin » Slider Revolution Responsive WordPress Plugin Slider Revolution.
    Anyone have any idea how to go about this? Any help would be appreciated. Thank you.

    Hi deltabrux,
    Can you share your Edge project files? Are your using EA 2014.1?
    Regards
    Vinod
    Edge Animate Team

  • How to replace wandering songs into albums?

    After a migration to a new iMac that didn't go well, iTunes was in chaos with most tracks duplicated. Thanks to "TidyUp!" software, that's now fixed and I've gone to 10.1.2 -- all's well except several albums seem to have broken up (as it were) with their songs scattered all around.
    Is there a simple way to put things right?

    Gosh, tt2 -- I owe you a "solved."
    It's because of the way I went about applying your advice. I first followed your link which says:
    +Use an album friendly view+
    +iTunes will let you sort music on many columns, some of which are unlikely to group albums together or put the tracks in their normal order. The most useful order for editing the library is probably the List View (or Album List view in iTunes 10.x) organised as Album by Artist. If you're not already there, select the list view and click on the column heading for Album until it reads Album by Artist.+
    So I do that and the problem disappears. Which is just what you say in your second comment.
    Thanks again . . . fortes

Maybe you are looking for

  • Camera Raw 4.0 Fill Light Slider Not Working

    Hi, Just installed Photoshop CS3, and I'm having an annoying problem. When using Camera Raw 4.0, all the sliders work smootly except for the Filli Light slider. Its the only slider that is almost impossible to adjust via dragging the slider via my mo

  • Recordable space on DVD-R vs. Dual-Layer DVD+R

    I have the PB 17" 1.67GHz Nov 2005 model with the DVD dual-layer burning drive. I bought a 15 pack Memorex DVD+R DL recordable 2.4x, 8.5GB, 240min video to experiment some with this media. On many of my DVD-R Single-Layer discs I can record data up t

  • About query keys F7-F8

    Hi to all, I have created in my form a toolbar with 3 button: 1) BTN_ENTERQUERY 2) BTN_RUNQUERY 3) BTN_DELQUERY The trigger WHEN-BUTTON-PRESSED execute actions for enter. run and delete query + a procedure that enable others button in the toolbar. Bu

  • Keep getting error message"an error occured while trying to access the service"

    I convert a pdf file to word every week, but today I keep getting the following error message "an error occurred while trying to access the service" Why is this happening?

  • RAW files being corrupted by Aperture

    Some of my RAW files stored in Aperture come in clean but eventually show up as corrupt. Specifically, a rectangular portion of the image will become banded with colors that don't belong there. Sometimes I see this happen to a file just after some si