Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 55/1413 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • In Android OS or Java, what's the difference between a character sequence and a string????

    - by K-RAN
    For the API (Android SDK API version 8) functions whose definitions list character sequence parameters, I can feed the function String instead. Best part is that they work the same way, no hassle, no warnings. Is there a difference between the two types? And more importantly, is there an inherent danger if I send the function a String instead of a character sequence??? Thanks for any clarifications!!! :D

    Read the article

  • String replacement on a whole text file in Python 3.x?

    - by SkippyFire
    How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way? I'm thinking that I could read the whole thing into memory, but I'm looking for a more elegant solution... Thanks in advance

    Read the article

  • Sorting mysql array value after string chars swapped from fetched DB data.

    - by Shail Patel
    I want to sort one column fetched from mysql DB, and stored in an array. After fetching I am doing below steps. 1- DB Fetching fields array in row format. ->Field1, Field2, Field3, Field4, Field5 2- From that fields array One columns data [Field3], swapping string keywords. eg. AB013, DB131, RS001 to->013AB, 131DB, 001RS Now I want to sort above value in new string format like-> 001RS, 013AB, 131DB

    Read the article

  • How to check if String value is Boolean type in Java?

    - by Ragnar
    I did a little search on this but couldn't find anything useful. The point being that if String value is either "true" or "false" the return value should be true. In every other value it should be false. I tried these: String value = "false"; System.out.println("test1: " + Boolean.parseBoolean(value)); System.out.println("test2: " + Boolean.valueOf(value)); System.out.println("test3: " + Boolean.getBoolean(value)); All functions returned false :(

    Read the article

  • In Java, is there a way to write a string literal without having to escape quotes?

    - by Matthew
    Say you have a String literal with a lot of quotation marks inside it. You could escape them all, but it's a pain, and difficult to read. In some languages, you can just do this: foo = '"Hello, World"'; In Java, however, '' is used for chars, so you can't use it for Strings this way. Some languages have syntax to work around this. For example, in python, you can do this: """A pretty "convenient" string""" Does Java have anything similar?

    Read the article

  • Module Adminhtml blocks not loading

    - by David Tay
    I was working on a Magento module and it was working fine. At some point, I was trying to enable WYSIWYG in an edit form 'content' field and suddenly, my adminhtml grid and edit blocks stopped being generated. On my system are TinyMCE and Fontis FCKEditor WYSIWYG editors extensions. I'm not sure what I did wrong but my adminhtml blocks will no longer generate. Here's a dump of all the blocks from my module's adminhtml layout: array(17) { [0]=> string(4) "root" [1]=> string(4) "head" [2]=> string(13) "head.calendar" [3]=> string(14) "global_notices" [4]=> string(6) "header" [5]=> string(4) "menu" [6]=> string(11) "breadcrumbs" [7]=> string(7) "formkey" [8]=> string(12) "js_translate" [9]=> string(4) "left" [10]=> string(7) "content" [11]=> string(8) "messages" [12]=> string(2) "js" [13]=> string(6) "footer" [14]=> string(8) "profiler" [15]=> string(15) "before_body_end" [16]=> string(7) "wysiwyg" } As you can see, the last item is "wysiwyg" but on the layout output of other magento modules, there are more blocks. For example, on MathieuF's calendar extension, these are all the layout blocks: array(26) { [0]=> string(4) "root" [1]=> string(4) "head" [2]=> string(13) "head.calendar" [3]=> string(14) "global_notices" [4]=> string(6) "header" [5]=> string(4) "menu" [6]=> string(11) "breadcrumbs" [7]=> string(7) "formkey" [8]=> string(12) "js_translate" [9]=> string(4) "left" [10]=> string(7) "content" [11]=> string(8) "messages" [12]=> string(2) "js" [13]=> string(6) "footer" [14]=> string(8) "profiler" [15]=> string(15) "before_body_end" [16]=> string(7) "wysiwyg" [17]=> string(27) "adminhtml_event.grid.child0" [18]=> string(12) "ANONYMOUS_19" [19]=> string(27) "adminhtml_event.grid.child1" [20]=> string(12) "ANONYMOUS_21" [21]=> string(27) "adminhtml_event.grid.child2" [22]=> string(20) "adminhtml_event.grid" [23]=> string(12) "ANONYMOUS_24" [24]=> string(19) "ANONYMOUS_17.child1" [25]=> string(14) "content.child0" } Does anyone have any idea what's wrong? I've already tried Alan Storm's Layout and Config Viewers and cannot find any clues as to what I did wrong. Any help would be greatly appreciated.

    Read the article

  • Powershell variables to string

    - by Mike Koerner
    I'm new to powershell. I'm trying to write an error handler to wrap around my script.  Part of the error handler is dumping out some variable settings.  I spent a while trying to do this and couldn't google a complete solution so I thought I'd post something. I want to display the $myinvocation variable. In powershell you can do this PS C:\> $myInvocation for my purpose I want to create a stringbuilder object and append the $myinvocation info.  I tried this $sbOut = new-object System.Text.Stringbuilder $sbOut.appendLine($myinvocation) $sbOut.ToString() This produces                                    Capacity                                MaxCapacity                                     Length                                    --------                                -----------                                     ------                                          86                                 2147483647                                         45 System.Management.Automation.InvocationInfo This is not what I wanted so I tried $sbOut.appendLine(($myinvocation|format-list *)) This produced                                    Capacity                                MaxCapacity                                     Length                                    --------                                -----------                                     ------                                         606                                 2147483647                                        305 Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Micros oft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.Powe rShell.Commands.Internal.Format.FormatEndData Finally I figured out how to produce what I wanted: $sbOut = new-object System.Text.Stringbuilder [void]$sbOut.appendLine(($myinvocation|out-string)) $sbOut.ToString() MyCommand        : $sbOut = new-object System.Text.Stringbuilder                                    [void]$sbOut.appendLine(($myinvocation|out-string))                                      $sbOut.ToString()                    BoundParameters  : {} UnboundArguments : {} ScriptLineNumber : 0 OffsetInLine     : 0 HistoryId        : 13 ScriptName       : Line             : PositionMessage  : InvocationName   : PipelineLength   : 2 PipelinePosition : 1 ExpectingInput   : False CommandOrigin    : Runspace Note the [void] in front of the stringbuilder variable doesn't show the Capacity,MaxCapacity of the stringbuilder object.  The pipe to out-string makes the output a string. It's not pretty but it works.

    Read the article

  • Find non-ascii characters from a UTF-8 string

    - by user10607
    I need to find the non-ASCII characters from a UTF-8 string. my understanding: UTF-8 is a superset of character encoding in which 0-127 are ascii characters. So if in a UTF-8 string , a characters value is Not between 0-127, then it is not a ascii character , right? Please correct me if i'm wrong here. On the above understanding i have written following code in C : Note: I'm using the Ubuntu gcc compiler to run C code utf-string is xvab c long i; char arr[] = "xvab c"; printf("length : %lu \n", sizeof(arr)); for(i=0; i<sizeof(arr); i++){ char ch = arr[i]; if (isascii(ch)) printf("Ascii character %c\n", ch); else printf("Not ascii character %c\n", ch); } Which prints the output like: length : 9 Ascii character x Not ascii character Not ascii character ? Not ascii character ? Ascii character a Ascii character b Ascii character Ascii character c Ascii character To naked eye length of xvab c seems to be 6, but in code it is coming as 9 ? Correct answer for the xvab c is 1 ...i.e it has only 1 non-ascii character , but in above output it is coming as 3 (times Not ascii character). How can i find the non-ascii character from UTF-8 string, correctly. Please guide on the subject.

    Read the article

  • Find all substrings of a string - StringIndexOutOfBoundsException

    - by nazar_art
    I created class Word. Word has a constructor that takes a string argument and one method getSubstrings which returns a String containing all substring of word, sorted by length. For example, if the user provides the input "rum", the method returns a string that will print like this: r u m ru um rum I want to concatenate the substrings in a String, separating them with a newline ("\n"). Then return the string. Code: public class Word { String word; public Word(String word) { this.word = word; } /** * Gets all the substrings of this Word. * @return all substrings of this Word separated by newline */ public String getSubstrings() { String str = ""; int i, j; for (i = 0; i < word.length(); i++) { for (j = 0; j < word.length(); j++) { str = word.substring(i, i + j); str += "\n"; } } return str; } But it throws exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1911) I stuck at this point. Maybe, you have other suggestions according this method signature public String getSubstrings(). How to solve this issue?

    Read the article

  • XSLT multiple string replacement with recursion

    - by John Terry
    I have been attempting to perform multiple (different) string replacement with recursion and I have hit a roadblock. I have sucessfully gotten the first replacement to work, but the subsequent replacements never fire. I know this has to do with the recursion and how the with-param string is passed back into the call-template. I see my error and why the next xsl:when never fires, but I just cant seem to figure out exactly how to pass the complete modified string from the first xsl:when to the second xsl:when. Any help is greatly appreciated. <xsl:template name="replace"> <xsl:param name="string" select="." /> <xsl:choose> <xsl:when test="contains($string, '&#13;&#10;')"> <xsl:value-of select="substring-before($string, '&#13;&#10;')" /> <br/> <xsl:call-template name="replace"> <xsl:with-param name="string" select="substring-after($string, '&#13;&#10;')"/> </xsl:call-template> </xsl:when> <xsl:when test="contains($string, 'TXT')"> <xsl:value-of select="substring-before($string, '&#13;TXT')" /> <xsl:call-template name="replace"> <xsl:with-param name="string" select="substring-after($string, '&#13;')" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> </xsl:template>

    Read the article

  • What's wrong with this code to un-camel-case a string?

    - by omair iqbal
    Here is my attempt to solve the About.com Delphi challenge to un-camel-case a string. unit challenge1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type check = 65..90; TForm1 = class(TForm) Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; var s1,s2 :string; int : integer; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var i: Integer; checks : set of check; begin s1 := edit1.Text; for i := 1 to 20 do begin int :=ord(s1[i]) ; if int in checks then insert(' ',s1,i-1); end; showmessage(s1); end; end. check is a set that contains capital letters so basically whenever a capital letter is encountered the insert function adds space before its encountered (inside the s1 string), but my code does nothing. ShowMessage just shows text as it was entered in Edit1. What have I done wrong?

    Read the article

  • How to split this string and identify first sentence after last '*'?

    - by DaveDev
    I have to get a quick demo for a client, so this is a bit hacky. Please don't flame me too much! :-) I'm getting a string similar to the following back from the database: The object of the following is to do: * blah 1 * blah 2 * blah 3 * blah 4. Some more extremely uninteresting text. Followed by yet another sentence full of extrememly uninteresting text. Thankfully this is the last sentence. I need to format this so that each * represents a bullet point, and the sentence after the last * goes onto a new line, ideally as follows: The object of the following is to do: blah 1 (StackOverflow wants to add bullet points here, but I just need '*') blah 2 blah 3 blah 4. Some more extremely uninteresting text. Followed by yet another sentence full of extrememly uninteresting text. Thankfully this is the last sentence. It's easy enough to split the string by the * character and replace that with <br /> *. I'm using the following for that: string description = GetDescription(); description = description.Replace("*", "<br />*"); // it's going onto a web page. but the result this gives me is: The object of the following is to do: blah 1 blah 2 blah 3 blah 4. Some more extremely uninteresting text. Followed by yet another sentence full of extrememly uninteresting text. Thankfully this is the last sentence. I'm having a bit of difficulty identifying the fist sentence after the last '*' so I can put a break there too. Can somebody show me how to do this?

    Read the article

  • How to parse a string (by a "new" markup) with R ?

    - by Tal Galili
    Hi all, I want to use R to do string parsing that (I think) is like a simplistic HTML parsing. For example, let's say we have the following two variables: Seq <- "GCCTCGATAGCTCAGTTGGGAGAGCGTACGACTGAAGATCGTAAGGtCACCAGTTCGATCCTGGTTCGGGGCA" Str <- ">>>>>>>..>>>>........<<<<.>>>>>.......<<<<<.....>>>>>.......<<<<<<<<<<<<." Say that I want to parse "Seq" According to "Str", by using the legend here Seq: GCCTCGATAGCTCAGTTGGGAGAGCGTACGACTGAAGATCGTAAGGtCACCAGTTCGATCCTGGTTCGGGGCA Str: >>>>>>>..>>>>........<<<<.>>>>>.......<<<<<.....>>>>>.......<<<<<<<<<<<<. | | | | | | | || | +-----+ +--------------+ +---------------+ +---------------++-----+ | Stem 1 Stem 2 Stem 3 | | | +----------------------------------------------------------------+ Stem 0 Assume that we always have 4 stems (0 to 3), but that the length of letters before and after each of them can very. The output should be something like the following list structure: list( "Stem 0 opening" = "GCCTCGA", "before Stem 1" = "TA", "Stem 1" = list(opening = "GCTC", inside = "AGTTGGGA", closing = "GAGC" ), "between Stem 1 and 2" = "G", "Stem 2" = list(opening = "TACGA", inside = "CTGAAGA", closing = "TCGTA" ), "between Stem 2 and 3" = "AGGtC", "Stem 3" = list(opening = "ACCAG", inside = "TTCGATC", closing = "CTGGT" ), "After Stem 3" = "", "Stem 0 closing" = "TCGGGGC" ) I don't have any experience with programming a parser, and would like advices as to what strategy to use when programming something like this (and any recommended R commands to use). What I was thinking of is to first get rid of the "Stem 0", then go through the inner string with a recursive function (let's call it "seperate.stem") that each time will split the string into: 1. before stem 2. opening stem 3. inside stem 4. closing stem 5. after stem Where the "after stem" will then be recursively entered into the same function ("seperate.stem") The thing is that I am not sure how to try and do this coding without using a loop. Any advices will be most welcomed.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >