Search Results

Search found 36172 results on 1447 pages for 'unicode string'.

Page 124/1447 | < Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >

  • win32 ruby1.9 regexp and cyrillic string

    - by scriper
    #coding: utf-8 str2 = "asdf????????" p str2.encoding #<Encoding:UTF-8> p str2.scan /\p{Cyrillic}/ #found all cyrillic charachters str2.gsub!(/\w/u,'') #removes only latin characters puts str2 The question is why \w ignore cyrillic characters? I have installed latest ruby package from http://rubyinstaller.org/. Here is my output of ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] As far as i know 1.9 oniguruma regular expression library has full support for unicode characters.

    Read the article

  • Classic ASP - How to convert string to UTF8 to USC2

    - by Brian G
    I have a problem where I am storing a UTF8 string in SQL Server as USC2, when I pull it out to display on a page with content-type set to UTF-8 it works fine. But I have a third party javascript component which when I pass it the string for the database it renders it as USC2. or not UTF8. Is there a way in ASP to convert this string to UTF-8 after reading it from the database to pass it to the third party component ( obfuscated ) . Hope this makes sense.

    Read the article

  • Avoiding string copying in Lua

    - by Matt Sheppard
    Say I have a C program which wants to call a very simple Lua function with two strings (let's say two comma separated lists, returning true if the lists intersect at all, false if not). The obvious way to do this is to push them onto the stack with lua_pushstring, which works fine, however, from the doc it looks like lua_pushstring but makes a copy of the string for Lua to work with. That means that to cross over to the Lua function is going to require two string copies which I could avoid by rewriting the Lua function in C. Is there any way to arrange things so that the existing C strings could be reused on the Lua side for the sake of performance (or would the strcpy cost pale into insignificance anyway)? From my investigation so far (my first couple of hours looking seriously at Lua), lite userdata seems like the sort of thing I want, but in the form of a string.

    Read the article

  • Quick question regarding this issue, Why doesnt it print out the second value(converted second value

    - by sil3nt
    Quick question, What have I done wrong here. The purpose of this code is to get the input into a string, the input being "12 34", with a space in between the "12" and "32" and to convert and print the two separate numbers from an integer variable known as number. Why doesn't the second call to the function copyTemp, not produce the value 34?. I have an index_counter variable which keeps track of the string index and its meant to skip the 'space' character?? what have i done wrong? thanks. #include <stdio.h> #include <string.h> int index_counter = 0; int number; void copyTemp(char *expr,char *temp); int main(){ char exprstn[80]; //as global? char tempstr[80]; gets(exprstn); copyTemp(exprstn,tempstr); printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); copyTemp(exprstn,tempstr); //second call produces same output shouldnt it now produce 34 in the variable number? printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); return 0; } void copyTemp(char *expr,char *temp){ int i; for(i = index_counter; expr[i] != '\0'; i++){ if (expr[i] == '0'){ temp[i] = expr[i]; } if (expr[i] == '1'){ temp[i] = expr[i]; } if (expr[i] == '2'){ temp[i] = expr[i]; } if (expr[i] == '3'){ temp[i] = expr[i]; } if (expr[i] == '4'){ temp[i] = expr[i]; } if (expr[i] == '5'){ temp[i] = expr[i]; } if (expr[i] == '6'){ temp[i] = expr[i]; } if (expr[i] == '7'){ temp[i] = expr[i]; } if (expr[i] == '8'){ temp[i] = expr[i]; } if (expr[i] == '9'){ temp[i] = expr[i]; } if (expr[i] == ' '){ temp[i] = '\0'; sscanf(temp,"%d",&number); index_counter = i+1; //skips? } } // is this included here? temp[i] = '\0'; }

    Read the article

  • mockito ArrayList<String> problem...

    - by Sardathrion
    I have a method that I am trying to unit test. This method takes a parameter as an ArrayList and does things with it. The mock I am trying to define is: ArrayList<String> mocked = mock(ArrayList.class); which gives a [unchecked] unchecked conversion" warning. ArrayList<String> mocked = mock(ArrayList<String>.class); gives me an error. Anyone care to enlighten me as to what I am doing wrong?

    Read the article

  • Convert Null Value to String - C#.NET

    - by peace
    foreach (PropertyInfo PropertyItem in this.GetType().GetProperties()) { PropertyItem.SetValue(this, objDataTable.Rows[0][PropertyItem.Name.ToString()], null); } In one of the loops i get this exceptional error: Object of type 'System.DBNull' cannot be converted to type 'System.String'. The error occurs because one of the fields in the database has no value (null), so the string property could not handle it. How can i convert this null to string? I got this solution If you know a shorter or better one, feel free to post it. I'm trying to avoid checking on every loop is current value is null or not.

    Read the article

  • Is it a good idea to return " const char * " from a function?

    - by AJ
    Now I have a function that has to return a string. I saw a particular implementation where he returns a const char * from the function. Something like this: const char * GetSomeString() { ........ return somestlstring.c_str(); } SomeOtherFoo () { const char * tmp = GetSomeString(); string s = tmp; } Now I felt there is something potentially wrong with this. Is my gut feel right? or Is this a perfectly safe code? Kindly give me ur suggestions. I have a feeling return const char * this way might result in havoc.. Thanks, Arjun

    Read the article

  • Count How many lines in a Java String

    - by Simon Guo
    Need some compact code for counting how many lines in a string. It should be Java Code. And the string is separated by \r or \n will be considered as a separate line. For example, "Hello\nWorld\nThis\nIs\t" should return 4. The prototype is private static int countLines(String str) {...} Can someone provide a compact code? I have solution at here but it is too long, I think. Thank you.

    Read the article

  • Glib convert epoch time to string.

    - by PP
    I am using glibs functions to convert epoch time to string as follows. But each time it is giving me some random time. //Convert Time in string. GDate *date = g_date_new_julian(timestampsecs); gchar date_string[50]; g_date_strftime(date_string, 50, (const gchar*)"%a, %I:%M %p", (const GDate*)date); printf("Date String [%s]\n", date_string ); Why this might be happening? am i missing anything? Thanks, PP.

    Read the article

  • request payload versus query string parameters

    - by Sarah Sides
    I am absolutely in the dark when it comes to this request payload that I'm seeing in my Chrome browser. A Query string will have a variable attached like session:2g0SoEE but this payload has just one long string I'm guessing is in base64. I do understand that the request payload can have whatever, but how do I use it? Can I do a post with jquery and send this request payload? For example: $.post(url, {variable: "variable"}, function(data){}); When this posts it will send &variable=variable this will be found as query string parameter in the headers sent in chrome. In this game I'm playing I see another piece of info being sending in the header called a payload request. I'm a confused as to how this is read, used, made, how I can reduplicate this? Here is something similar: Chrome is caching an HTTP PUT request and How to retrieve Request Payload

    Read the article

  • WPF - Correct Syntax for Using Coverter with Current Binding

    - by Andy T
    Hi, I have a collection of hex strings that represent colours and I am binding a combobox's ItemsSource to that collection. The combobox items are templated to have a filled rectangle with the relevant colour. I therefore need to use a converter to convert the hex value to a string. Easy enough. However, Blend is telling me that this syntax is incorrect in my XAML: Fill="{Binding, Converter={StaticResource StringToBrush}}" Apparently, I can't use a converter against plain old 'Binding'. Blend says that something like this is syntactically correct: Fill="{Binding Value, Converter={StaticResource StringToBrush}}" ...However that obviously doesn't work. I'm not quite au fait with binding syntax yet, so obviously I'm getting it wrong. Can anyone advise the correct syntax to achieve what I'm trying to do (convert my bound String using the coverter StringToBrush)? Thanks in advance! AT

    Read the article

  • Converting Negative Decimal To String Loses the -

    - by coffeeaddict
    I'm required to send in a negative myDecimalValue.ToString("C"); The problem is if myDecimalValue is a negative, lets say -39, after conversion I'm getting $39.00 as the string not $39.00. So I'm not sure how to go about this. This is the utility method that takes in the decimal. If the decimal is negative, I want the ToString to show a negative public static BasicAmountType CreateBasicAmount(string amount, CurrencyCodeType currencyType) { BasicAmountType basicAmount = new BasicAmountType { currencyID = currencyType, Value = amount }; return basicAmount; } I could go either way, a C or F2, all I care is about getting that negative sign intothe string if the incoming decimal is negative. I suppose there's no way to do this unless I check for negativity inside my utility method here. I can't just send a negative number and expect the ToString to work and for the ToSTring to automatically see that the decimal is negative incoming?

    Read the article

  • how to replace multi string with a array node in js

    - by Rueta
    hi everyone! i here a Work and i don't know how to do it. i have a string here: <div class="demotext"> <p>this is demo string i demo want to demo use</p> </div> i create the array variable for demo: var demoarray = new array('a','b','c'); now i want replace 'demo' in string by array node, follow 'demo' one change to 'a' , 'demo' two change to 'b'....

    Read the article

  • ColdFusion static key/value list?

    - by richardtallent
    I have a database table that is a dictionary of defined terms -- key, value. I want to load the dictionary in the application scope from the database, and keep it there for performance (it doesn't change). I gather this is probably some sort of "struct," but I'm extremely new to ColdFusion (helping out another team). Then, I'd like to do some simple string replacement on some strings being output to the browser, looping through the defined terms and replacing the terms with some HTML to define the terms (a hover or a link, details to be worked out later, not important). Can anyone point me in the right direction of: How to define the stucture (if that is what I need for a key/value pair list) How to query at the application start-up and reuse the list properly The best way to do the string replacement

    Read the article

  • Convert String value format of YYYYMMDDHHMMSS to C# DateTime

    - by SARAVAN
    I have a need to convert a string value in the form "YYYYMMDDHHMMSS" to a DateTime. But not sure on how, may be a DateTime.Tryparse can be used to make this happen. Or is there any other way to do it. I can do this using some string operations to take "YYYYMMDD" alone, convert to a datetime and then add HH, MM, SS separately to that DateTime. But is there any DateTime.TryParse() methods that I can use in one line to convert a "YYYYMMDDHHMMSS" format string value to a DateTime value?

    Read the article

  • JavaScript - checking for any lowercase letters in a string

    - by pcampbell
    Consider a JavaScript method that needs to check whether a given string is in all uppercase letters. The input strings are people's names. The current algorithm is to check for any lowercase letters. var check1 = "Jack Spratt"; var check2 = "BARBARA FOO-BAR"; var check3 = "JASON D'WIDGET"; var isUpper1 = HasLowercaseCharacters(check1); var isUpper2 = HasLowercaseCharacters(check2); var isUpper3 = HasLowercaseCharacters(check3); function HasLowercaseCharacters(string input) { //pattern for finding whether any lowercase alpha characters exist var allLowercase; return allLowercase.test(input); } Is a regex the best way to go here? What pattern would you use to determine whether a string has any lower case alpha characters?

    Read the article

  • Using Regex to modify a String

    - by Christine Dehner
    I have a String that looks like this: Blah blah one.<tmp>[[url=b, link=c]]</tmp> Blah blah two. Also remember, blah blah three.<tmp>[[url=d, link=e]]</tmp> So I want to get b and d (the url attribute of tmp), and change the String so that it looks like this (the ex() function returns a String): Blah blah one.<tmp>[[url=b, link=c, add=ex(b)]]</tmp> Blah blah two. Also remember, blah blah three.<tmp>[[url=d, link=e, add=ex(d)]]</tmp> I need to use regex because no existing library parses this type of markup. I hope my explanation is clear. Thanks in advance!

    Read the article

  • Best way for saving infinit playlists (arrays) into db? (php mySql)

    - by Ole Jak
    So client gives me a string like "1,23,23,abc,ggg,544,tf4," from user 12 . There can be infinit number of elements with no spaces just value,value,... structure. I have users table (with users uId(key), names etc). I have streams table with ( sId(key), externalID, etc values). User sends me externalId's. And I need to hawe externalId's in play list (not my sId's). I need some way to store such array into my DB and be able to get it from DB. I need to be able to do 2 things return such string back to user be able to get na array from it like {1; 23; 23; abc; ggg; 544; tf4;} So what is best method (best here means shourt(small amount of) code) to store such data into db to retrivew stored tata in bouth ways shown

    Read the article

  • How to remove control chars from UTF8 string

    - by Mimefilt
    Hi there, i have a VB.NET program that handles the content of documents. The programm handles high volumes of documents as "batch"(2Million documents;total 1TB volume) Some of this documents may contain control chars or chars like f0e8(http://www.fileformat.info/info/unicode/char/f0e8/browsertest.htm). Is there a easy and especially fast way to remove that chars?(except space,newline,tab,...) If the answer is regex: Has anyone a complete regex for me? Thanks!

    Read the article

  • String to image only produces black background

    - by Phil Jackson
    Hi im really having a problem find how to fix this. $string = "foo"; $font = 4; $width = ImageFontWidth($font) * strlen($string); $height = ImageFontHeight($font); $im = @imagecreatetruecolor ($width,$height); $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 0); imagestring($im, 5, 0, 0, $string, $textcolor); imagegif($im, 'somefile.gif', 8); imagedestroy($im); I cannot seem to change the background from black. Does anyone have any ideas?

    Read the article

  • Java - Need help with binary/code string manipulation

    - by ShrimpCrackers
    For a project, I have to convert a binary string into (an array of) bytes and write it out to a file in binary. Say that I have a sentence converted into a code string using a huffman encoding. For example, if the sentence was: "hello" h = 00 e = 01, l = 10, o = 11 Then the string representation would be 0001101011. How would I convert that into a byte? <-- If that question doesn't make sense it's because I know little about bits/byte bitwise shifting and all that has to do with manipulating 1's and 0's.

    Read the article

  • How to convert List<int> to string[]?

    - by George Edison
    I need an easy way to convert a List<int> to a string array. I have: var the_list = new List<int>(); the_list.Add(1); the_list.Add(2); the_list.Add(3); string[] the_array = new string[the_list.Count]; for(var i = 0 ; i < the_array.Count; ++i) the_array[i] = the_list[i].ToString(); ...which looks to be very ugly to me. Is there an easier way? Note: I'm looking for an easier way - not necessarily a faster way.

    Read the article

  • Parse a json(?) string using php

    - by passatgt
    I have a string, more specifically, this one: a:16:{s:9:"pseudonym";O:16:"SimpleXMLElement":0:{}s:14:"parallel_title";O:16:"SimpleXMLElement":0:{}s:9:"title_var";O:16:"SimpleXMLElement":0:{}s:6:"series";O:16:"SimpleXMLElement":0:{}s:9:"vol_title";O:16:"SimpleXMLElement":0:{}s:9:"reference";O:16:"SimpleXMLElement":0:{}s:10:"bound_with";O:16:"SimpleXMLElement":0:{}s:15:"general_remarks";O:16:"SimpleXMLElement":0:{}s:6:"copies";O:16:"SimpleXMLElement":1:{i:0;s:1:"1";}s:11:"remarks_BPH";O:16:"SimpleXMLElement":0:{}s:3:"ICN";O:16:"SimpleXMLElement":1:{i:0;s:4:"neen";}s:10:"provenance";O:16:"SimpleXMLElement":0:{}s:7:"binding";O:16:"SimpleXMLElement":0:{}s:10:"size_hxwxd";O:16:"SimpleXMLElement":0:{}s:6:"BookID";O:16:"SimpleXMLElement":1:{i:0;s:4:"6271";}s:5:"repro";O:16:"SimpleXMLElement":0:{}} Is it possible to parse this string somehow? I need to display the keys and values in a list. I tried to use json_decode but it not returns anything, even with the second true parameter(json_decode($string,true))

    Read the article

< Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >