Substring question

Hello All,
This is probably a very naive issue.
I am trying to apply subString to a String based on the index of the following pattern in the string:
I am getting a compilation error. My question is: what kind of escape sequence is required to allow the above?
Any help is truly appreciated.
Thank you very much in advance.
Mahbubur

I take it you mean literally that string, including the quotation marks?
You can escape a quotation mark with a backslash character thusly:
String searchString = "\" , \"";

Similar Messages

  • Wrong Answer for substring question?

    This is the question from one of Sun's e-Practice exams. I am only posting it because I believe the answer is wrong.
    QUESTION:
    A text field in a GUI allows a user to type in a string, pNum, that represents a telephone number in the following format: AAA-PPP-NNNN; where A, P, and N are digits. Assume that this string format has been validated by another part of the system.
    Which line of code generates a string in the format AAAPPPNNNN that will be stored to a database?
    SUN's ANSWER:
    pNum.substring(0,3) + pNum.substring(4,7) + pNum.substring(8,12)
    This answer is INCORRECT as it would produce: AAA-PPP-NNNN[EXTRA] and NOT the desired: AAAPPPNNNN
    SHOULDN'T THE RIGHT ANSWER BE:
    pNum.substring(0,2) + pNum.substring(4,6) + pNum.substring(8,11)
    THIS WOULD PRODUCE: AAAPPPNNNN
    Note: If it is representing the string without the '-' characters (as if a 'replace' is implied), SUN's answer would still be wrong.. it should then be:
    pNum.substring(0,2) + pNum.substring(3,5) + pNum.substring(6,9)
    THIS WOULD PRODUCE: AAAPPPNNNN
    Does anyone agree with me?

    Read the API, where it says:
    "The substring begins at the specified beginIndex and extends to the character at index endIndex - 1."Note that it ends not at endIndex, but at endIndex - 1.

  • Utf8 and substr question

    Hi!
    We're using oracle linux 5 as os and oracle 11.2 ee and AL32UTF8 characterset in our db. The os locale is set to en_US.UTF-8 and NLS_LANG is set to AMERIAN_AMERICA.AL32UTF8.
    The users of different countries (western and eastern europe) work with a forms application and modify data (with language specific characters) in the UTF8 database without any problems.
    On the database server we generate some flat files (over all countries) for different interfaces. When I open the flat file in a shell with putty (setting character set to UTF8) every language specific character is correct.
    Our partners load the flat file via sql loader in a flat table and split it up with their own procedures. Our hungarian partner has troubles with special characters. For testing I've set the NLS to HUNGARIAN_HUNGARY.EE8MSWIN1250 before creating the flat file. Now he could process the file.
    So what is wrong in his environment? He is also using AL32UTF in his database. Should he use substrc instead of a normal substr function in his procedures? He also tried to set NLS to AMERIAN_AMERICA.AL32UTF8 before processing the flat file without positive result...
    Thanks
    Markus

    ## Our hungarian partner has troubles with special characters.
    We cannot help with so little information. If setting NLS_LANG to .EE8MSWIN1250 helped, then the partner's client environment may be set to .EE8MSWIN1250 as well and files encoded in AL32UTF8 do not load correctly. The partner's test to set NLS_LANG could have been flawed (e.g. a misspelled variable name) and this is why it did not helped. But I can only speculate.
    -- Sergiusz

  • Multi-column chart issues

    Hi,
    I'm trying to make a 2d column chart of quiz entry results with multiple series (one per possible answer) but it's not working as intended. I have 5 series all with code like:
    select null link, substr(question, 1, INSTR(question,' - ',1,1)), count(answer) from quizdata
    where answer ='Strongly Disagree'
    and :P13_DEP = emp_dep
    and to_char(sysdate, 'YYYY') = to_char(ins_date, 'YYYY')
    group by substr(question, 1, INSTR(question,' - ',1,1))Except with the answer being different (Agree, Strongly Agree~). However, when I load the page it only shows the results of the first series (Strongly Disagree, or if I delete that then Disagree)...anyone see what I'm doing wrong?
    x-axis = question
    y-axis = count (number of people to select that option this year)
    There should be 5 columns per question.
    Mike

    For anyone who has a similar issue with multiple series being displayed the reason for my error was that I didn't specify a name for the value...since all of them were count(c) they clashed; making it count(c) "Disagree" etc made it display as intended.
    Mike

  • Concat substring and string question

    Hello,
          So I am trying to add together a string \\fafs10\home and the concat of a substring of the first initial of a GivenName and LastName. I keep getting a NaN error.
    Here's what I have:
    =string("\\fafs10\home\") + concat(substring(GivenName,0,1), LastName)
    I want to return this as a default value to my list.
    Any help would be greatly appreciated. Thank you.
    Matthew

    Hi
    are you doing this in a calculated column or within a rule on an InfoPath form or another way?
    you should probably just go with
    concat("\\fafs10\home\",substring(GivenName,0,1),LastName)
    Regards
    Sergio Giusti Sergio Blogs
    Linked
    In Profile
    Whenever you see a reply you think is helpful, click Vote As Helpful.
    Whenever you see a reply you think is the answer to the question, click Mark As Answer.

  • A question about substring???

    I have a simple question...
    x = "ABCDE";
    How to get the String "CD" from the String x???
    thx....

    why don't you just look up the javadocs?
    substring
    public String substring(int beginIndex,
    int endIndex)
    Returns a new string that is a substring of this string. The substring begins at the
    specified beginIndex and extends to the character at index endIndex - 1. Thus the
    length of the substring is endIndex-beginIndex.
    Examples:
    "hamburger".substring(4, 8) returns "urge"
    "smiles".substring(1, 5) returns "mile"
    Parameters:
    beginIndex - the beginning index, inclusive.
    endIndex - the ending index, exclusive.
    Returns:
    the specified substring.
    Throws:
    IndexOutOfBoundsException - if the beginIndex is negative, or endIndex is
    larger than the length of this String object, or beginIndex is larger than endIndex.

  • Question re SUBSTR function

    Greetings,
    I have a text file with text formatted similarly to this in a variable V1...
    I do not want this part,I want this part, I do not want this part.
    I am trying to find a way to extract the segment between the two commas and am unable to figure out how to do this. The following code segment is the way I have started....
    dbms_output.put_line(substr(V1,(instr(v1,',',1,1)+1),(instr(v1,',',1,2)-1)));
    which of course doesn't work properly. Is there a straightforward way to get the length of the string between the two commas and use that in place of the fragment (instr(v1,',',1,2)-1))?
    Suggestions greatly appreciated.
    Thanks
    Bill Wagman

    Maybe this is helpful
    with testdata as (Select 'abc,def,ghi' as str from dual)
    select str,
           REGEXP_SUBSTR (str, '[^,]*', 1, 1) "sub1",
           REGEXP_SUBSTR (str, '[^,]*', 1, 2) "sub2",
           REGEXP_SUBSTR (str, '[^,]*', 1, 3) "sub3",
           REGEXP_SUBSTR (str, '[^,]*', 1, 4) "sub4"
    from testdata;
    STR          sub1     sub2     sub3     sub4
    abc,def,ghi     abc          def     the * means zero or more repetitions (of any char). You could also write it like this '[^,]{0,}'the + means 1 or more repetitions (of any char) and could also be written as this '[^,]{1,}'REGEXP_SUBSTR works from left to right analyzing each character (or byte). Lets call each repetition of the pattern matching process a "word".
    Whenever it meets a character that falls into the pattern, then this character is added to the "word".
    As soon as a letter does not match the pattern anymore then it starts looking for a new word.
    So let us take your string apart.
    "a" => matches the pattern and is added to the word1. "a"
    "b"=> matches the pattern and is added to the word1. "ab"
    "c"=> matches the pattern and is added to the word1. "abc"
    "," => does not match anymore. Therefore the word1 is finished. However this character could be the beginning of a new word.
    "," => does match the condition "zero repetitions". Therefore it starts word2. But word2 so far is empty. Because the "not ," condition prevents this character to be included in the output.
    "d" => does not match the condition "zero repetitions" for word2 anymore. Therefore word2 is finished.
    "d" => matches the pattern and is added to the word3. "d"
    "e" => matches the pattern and is added to the word3. "de"
    and so on.
    I know this explaination is a bit clumsy, but it might help to understand how the pattern matching progress is done.
    Edited by: Sven W. on Mar 8, 2011 4:20 PM - improved indention of sample output

  • Substr/Instr/analytics question

    I have a table like this on 9i (soon to be 10g)
    CREATE TABLE BASELINE_TESTRUN
    RUNID VARCHAR2(42 BYTE) NOT NULL
    with data like this:
    insert into BASELINE_TESTRUN values ('DEV1-XXX-01');
    insert into BASELINE_TESTRUN values ('DEV1-XXX-03');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-01');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-02');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-03');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-05');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-06');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-06');
    The output should be the next higher number of the last substring in runid
    DEV1-XXX 04
    DEV2-XXX 07
    There may be missing no, and/or duplicates.
    This was my Query for this - It works but seems rather clumsy. I would like to have done it in 1 SQL (avoiding the select from (select)):
    select runid , max (next_runno) next_runno
    from
    select substr(runid,1,instr(runid,'-',1,2)-1) runid,
    max(substr(runid,instr(runid,'-',1,2)+1))
    over(partition by substr(runid,1,instr(runid,'-',1,2)-1)) + 1 next_runno
    from baseline_testrun
    where instr(runid,'-',1,2) > 0
    ---where runid like 'whatever%'
    group by runid;
    Alternate solutions would be appreciated ... and NO I did not define that table like this.
    I would have preferred a sequence and a keys that was not composit (Codd/Date, pls. forgive the creators of the table)
    best regards
    Mette

    You are grouping you data. In this case an aggregate function could be more helpful than an analytic function.
    In 9i already you are be able to use the KEEP syntax for aggregates.
    Look at this example
    SQL> select substr(runid,1,instr(runid,'-',1,2)-1) group_run,
      2  to_number(
      3  max(substr(runid, instr(runid,'-',1,2)+1))
      4  keep (dense_rank last order by substr(runid, instr(runid,'-',1,2)))
      5  )+1 max_run
      6  from BASELINE_TESTRUN
      7  group by substr(runid,1,instr(runid,'-',1,2)-1);
    GROUP_RUN                                     MAX_RUN
    DEV1-XXX                                            4
    DEV2-XXX                                            7
    SQL> Dimas Version is better, since it avoids the keep syntax, that is not really needed for this special case.
    Message was edited by:
    Sven W.

  • Question on Substring or Regular Expression

    Experts,
    I have values is column similar to this:
    Remarks:
    IHCIS 651216 K6
    KORE 657526
    COR SWITX 658999 K6 ADHOC
    I need to pull out the number starting with "6" (it always starts with 6, and it is always six characters). I then need to set the value of another column to that substring.
    Update table x
    set p_code = "Query returning the substring value"
    I've used substring before but I don't know how to search for the "6" since it is in different locations for each row.
    Any help is greatly appreciated.
    Rich

    Hi,
    Here is an example using "SUBSTR':
    SQL> select substr('IHCIS 651216 K6', instr('IHCIS 651216 K6', '6') , 6) from dual;
    SUBSTR
    651216

  • Quick question- substr...

    I have the following code:
    <%
    java.util.Enumeration headerNames = request.getHeaderNames();
    String accLang = request.getHeader("Accept-Language");
    out.println(accLang.substr(0,4));
    %>
    and I am getting and error: Method substr(int, int) not found in class java.lang.String. If I don't do the substr then it works fine so I am getting the variable. Is the syntax wrong, all I want to do is print the first four characters of accLang?
    Thanks.

    please look for the api documentation for the exact signature. The function is substring not substr

  • Java Regex Question extract Substring

    Hello
    I've readt the regex course on http://www.regenechsen.de/regex_de/regex_1_de.html but the regex rules described in the course and its behavior in the "real world" doesn't makes sense. For sample: in the whole string: <INPUT TYPE="Text" name="Input_Vorname">
    the matcher should extract only the fieldname so "Input_Vorname" i tried a lot of patterns so this:
    "name="(.*?)\"";
    "<.*name=\"(.*)\".?>";
    "<.*?name=\"(w+)\".*>";
    "name=\".*\"";
    and so on. But nothing (NOTHING) works. Either it finds anything or nothing. Whats wrong ?
    Can somebody declare me what I've made wrong and where my train of thought was gone wrong?
    Roland

    When you use the matches() method, the regex has to match the entire input, but if you use find(), the Matcher will search for a substring that matches the regex. Here's how you would use it:  String nameRegex = "name=\"(.*?)\"";
      Pattern namePattern = Pattern.compile(nameRegex,Pattern.CASE_INSENSITIVE);
      Matcher nameMatcher = namePattern.matcher(token);
      if (nameMatcher.find()) {
        String fieldName = nameMatcher.group(1);
      }But the main issue is that you're using the wrong method(s) to retrieve the name. The start() and end() methods return the start and end positions of the entire match, but you're only interested in whatever was matched by the subexpression inside the parentheses (round brackets). That's called a capturing group, and groups are numbered according to the order in which they appear, so you should be using start(1) and end(1) instead of start() and end(). Or you can just use group(1), as I've done here, which returns the same thing as your substring() call.
    Knowing that, you could go ahead and use matches(), with an appropriate regex:  String nameRegex = "<.*?name=\"(\\w+)\".*?>";
      Pattern namePattern = Pattern.compile(nameRegex,Pattern.CASE_INSENSITIVE);
      Matcher nameMatcher = namePattern.matcher(token);
      if (nameMatcher.matches()) {
        String fieldName = nameMatcher.group(1);
      }

  • Substring regex question

    Hi, I am trying to come up with a regular expression that will find the 4 digit year in the following example strings and get the character position. (The string lengths may vary...):
    /foo/boo/goo/2008/01/20/foo.htm
    /foo/2/goo/2008/01/11/foo.htm
    Ultimately, I would like to know the character position of the first digit of the year.
    Thanks in advance for any help!

    String s = "foo/foo/2008/01/02/foo";
    Pattern p = Pattern.compile("\\d{4}/\\d{2}/\\d{2}");
    Matcher m = p.matcher(s);
    if (m.find())
       System.out.println(m.start());

  • Substring query question

    How can I improve this query to only insert the first 40 chars. Table1, column1 type is VARCHAR2(100), but I just need up to 40 chars.
    INSERT /*+ append */ INTO Table2 (column1) SELECT (column1) FROM (table1);
    COMMIT;

    Well really wat I want to do is extract the first word from a column that is less then 40chars, otherwise extract the first 40 chars. And I want to do this to thousands of records, inserting them into a new table.

  • Newbie question on FindChangeByList script (REVISED)

    Hi...I'm using FindChangeByList (the Javascript version) and I have a question. The default behavior of this script seems to be the following:
    1. If text is selected, then run the script on the text
    2. Otherwise, run the script on the entire document.
    By looking at the script (which I'm pasting below), I can see that the script is intentionally set up this way. I'm totally new to scritping, but by reading the remarks I think these are the relevent lines:
    //Something was selected, but it wasn't a text object, so search the document.
         myFindChangeByList(app.documents.item(0));
    and
    //Nothing was selected, so simply search the document.
       myFindChangeByList(app.documents.item(0));
    MY GOAL:  I want to prevent the script running on my entire document by mistake if I mistakenly don't have the Text tool active.
    I have a feeling that would be very easy to write, but since I know nothing about scripting, I appeal to this forum. Thanks.
    If you need it, the entire script is pasted below. (It's also a standard sample script built into CS4).
    //FindChangeByList.jsx
    //An InDesign CS4 JavaScript
    @@@BUILDINFO@@@ "FindChangeByList.jsx" 2.0.0.0 10-January-2008
    //Loads a series of tab-delimited strings from a text file, then performs a series
    //of find/change operations based on the strings read from the file.
    //The data file is tab-delimited, with carriage returns separating records.
    //The format of each record in the file is:
    //findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
    //Where:
    //<tab> is a tab character
    //findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
    //findProperties is a properties record (as text) of the find preferences.
    //changeProperties is a properties record (as text) of the change preferences.
    //findChangeOptions is a properties record (as text) of the find/change options.
    //description is a description of the find/change operation
    //Very simple example:
    //text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
    //More complex example:
    //text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price".
    //All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
    //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
    //as shown in the example below:
    //{findWhat:"\\s+"}
    //For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
    main();
    function main(){
    var myObject;
    //Make certain that user interaction (display of dialogs, etc.) is turned on.
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    if(app.documents.length > 0){
      if(app.selection.length > 0){
       switch(app.selection[0].constructor.name){
        case "InsertionPoint":
        case "Character":
        case "Word":
        case "TextStyleRange":
        case "Line":
        case "Paragraph":
        case "TextColumn":
        case "Text":
        case "Cell":
        case "Column":
        case "Row":
        case "Table":
         myDisplayDialog();
         break;
        default:
         //Something was selected, but it wasn't a text object, so search the document.
         myFindChangeByList(app.documents.item(0));
      else{
       //Nothing was selected, so simply search the document.
       myFindChangeByList(app.documents.item(0));
    else{
      alert("No documents are open. Please open a document and try again.");
    function myDisplayDialog(){
    var myObject;
    var myDialog = app.dialogs.add({name:"FindChangeByList"});
    with(myDialog.dialogColumns.add()){
      with(dialogRows.add()){
       with(dialogColumns.add()){
        staticTexts.add({staticLabel:"Search Range:"});
       var myRangeButtons = radiobuttonGroups.add();
       with(myRangeButtons){
        radiobuttonControls.add({staticLabel:"Document"});
        radiobuttonControls.add({staticLabel:"Selected Story", checkedState:true});
        if(app.selection[0].contents != ""){
         radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
    var myResult = myDialog.show();
    if(myResult == true){
      switch(myRangeButtons.selectedButton){
       case 0:
        myObject = app.documents.item(0);
        break;
       case 1:
        myObject = app.selection[0].parentStory;
        break;
       case 2:
        myObject = app.selection[0];
        break;
      myDialog.destroy();
      myFindChangeByList(myObject);
    else{
      myDialog.destroy();
    function myFindChangeByList(myObject){
    var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
    var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, myStory;
    var myStartCharacter, myEndCharacter;
    var myFindChangeFile = myFindFile("/FindChangeSupport/FindChangeList.txt")
    if(myFindChangeFile != null){
      myFindChangeFile = File(myFindChangeFile);
      var myResult = myFindChangeFile.open("r", undefined, undefined);
      if(myResult == true){
       //Loop through the find/change operations.
       do{
        myLine = myFindChangeFile.readln();
        //Ignore comment lines and blank lines.
        if((myLine.substring(0,4)=="text")||(myLine.substring(0,4)=="grep")||(myLine.substring(0,5)=="glyph")){
         myFindChangeArray = myLine.split("\t");
         //The first field in the line is the findType string.
         myFindType = myFindChangeArray[0];
         //The second field in the line is the FindPreferences string.
         myFindPreferences = myFindChangeArray[1];
         //The second field in the line is the ChangePreferences string.
         myChangePreferences = myFindChangeArray[2];
         //The fourth field is the range--used only by text find/change.
         myFindChangeOptions = myFindChangeArray[3];
         switch(myFindType){
          case "text":
           myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
          case "grep":
           myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
          case "glyph":
           myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
           break;
       } while(myFindChangeFile.eof == false);
       myFindChangeFile.close();
    function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change preferences before each search.
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences = NothingEnum.nothing;
    var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    myFoundItems = myObject.changeText();
    //Reset the find/change preferences after each search.
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences = NothingEnum.nothing;
    function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change grep preferences before each search.
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences = NothingEnum.nothing;
    var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    var myFoundItems = myObject.changeGrep();
    //Reset the find/change grep preferences after each search.
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences = NothingEnum.nothing;
    function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
    //Reset the find/change glyph preferences before each search.
    app.changeGlyphPreferences = NothingEnum.nothing;
    app.findGlyphPreferences = NothingEnum.nothing;
    var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
    myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
    myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
    app.doScript(myString, ScriptLanguage.javascript);
    var myFoundItems = myObject.changeGlyph();
    //Reset the find/change glyph preferences after each search.
    app.changeGlyphPreferences = NothingEnum.nothing;
    app.findGlyphPreferences = NothingEnum.nothing;
    function myFindFile(myFilePath){
    var myScriptFile = myGetScriptPath();
    var myScriptFile = File(myScriptFile);
    var myScriptFolder = myScriptFile.path;
    myFilePath = myScriptFolder + myFilePath;
    if(File(myFilePath).exists == false){
      //Display a dialog.
      myFilePath = File.openDialog("Choose the file containing your find/change list");
    return myFilePath;
    function myGetScriptPath(){
    try{
      myFile = app.activeScript;
    catch(myError){
      myFile = myError.fileName;
    return myFile;
    Message was edited by: JoJo Jenkins. Proper script formatting was used and the question was revised and made more concise.

    You can't check which instrument is active in InDesign by script (although you can select it, but it's not useful in your case).
    I suggest you  the following approach: check if a single object is selected and if it's a text frame — if so, make a search without showing the dialog.
    Notice that use
    myFindChangeByList(app.selection[0].parentStory.texts[0]);
    instead of
    myFindChangeByList(app.selection[0]);
    this allows me to process threaded and overset text.
    function main(){
         var myObject;
         //Make certain that user interaction (display of dialogs, etc.) is turned on.
         app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
         if(app.documents.length > 0){
              if(app.selection.length == 1 && app.selection[0].constructor.name == "TextFrame"){
                   myFindChangeByList(app.selection[0].parentStory.texts[0]);
              else if(app.selection.length > 0){
                   switch(app.selection[0].constructor.name){
                        case "InsertionPoint":
                        case "Character":
                        case "Word":
                        case "TextStyleRange":
                        case "Line":
                        case "Paragraph":
                        case "TextColumn":
                        case "Text":
                        case "Cell":
                        case "Column":
                        case "Row":
                        case "Table":
                             myDisplayDialog();
                             break;
                        default:
                             //Something was selected, but it wasn't a text object, so search the document.
                             myFindChangeByList(app.documents.item(0));
              else{
                   //Nothing was selected, so simply search the document.
                   myFindChangeByList(app.documents.item(0));
         else{
              alert("No documents are open. Please open a document and try again.");

  • How to find a substring in XML-lookslike string?

    Hi,
    I have a question and wondering if anyone can help me with it.
    We have Java tool that does a string replacement inside another string (that is actually an XML request). It works fine when searching for a simple substring (that exists within 1 line of the XML string).
    But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. And I'm not sure what is wrong or (more importantly) how to make it work.
    There is no return or new-line chars seen in the XML request.
    To make it more clear - here is what I have and trying to do:
    <a>
    <a>
    <b>
    <c>
    <d> </d>
    <c>
    <c>
    </c>
    </c>
    </c>
    </b>
    </a>
    </a>
    If I'll seach for either <c> OR </c> OR <d> </d> it all works fine ... BUT if Itry to find
    </c>
    </b>
    which will be copied directly from the XML request and past into field - thus it will look like this (horisontal line instead of vertical) </c> </b> - it does not work

    qavlad wrote:
    But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. First statement - "more than 1 line"
    There is no return or new-line chars seen in the XML request.Second statement.
    There is no way that I can understand what you meant in your first statement in terms of your second.
    If there are no end of line characters at all then there is only one line. Period.
    If there are end of line characters, of any kind, then that would really suggest the source of the problem.

Maybe you are looking for

  • Delivery document

    Hi there,   I am viewing a Purchase Order in ECC.   I am told that this PO will then result to a Delivery document which will contain the exact quantity of items dispatched from the warehouse.   Could some please tell me where can I the resulting Del

  • New partition on external hard drive won't mount

    I have an 2TB external drive connected by FireWire to my 24-inch, Early 2009 iMac. I created 2 partitions 1 that is about 35 GB and another that is the rest of the 2TB. The 2nd largest partition mounts fine and is being used by Time Machine for my ba

  • [JS] [CS3 onwards]

    Hi. I am needing to include in my script the ability to change paragraph styles, but the target style is within a paragraph style folder. My current code for a folderless structure is this: if(myStory.paragraphs[ii].appliedParagraphStyle.name == "PRO

  • Comment blocks in labview?

    is there any way to make a comment block, i.e. /* comments.... */ in labview? I suppose you could enclose your code in a case or while loop that never executes- but what if you are trying to comment out code that doesn't work? Seems like this would b

  • How can i get an Applet transfer data to a servlet like a Form does?

    it is clear that URL class provides way to connect to remote web resource. and furthermore i am trying to make an applet perform like a Form in html to send user data to a servlet. i may adhere a long name-value string to url sent by applet but this