string

Find the position of a string in an array of string with the GLib

Hello, I have an array of string, like: char **strings = {"str1", "str2"}; And i would like to know if there is a function in the glib to find the position of a string in this array. I guess i could just do g_strcmp0 in a for() loop, but there may be a better way to do it. Thanks ...

Python adding elements from string

I have a string like this "1 1 3 2 1 1 1 2 1 1 1 1 1 1 1 1,5 0,33 0,66 1 0,33 0,66 1 1 2 1 1 2 1 1 2 0,5 0,66 2 1 2 1 1 1 0 1". How to add elements to each other in python ? ...

String length without using length() method in java

How can i find the string length without using the length() method in java ...

How can I put quotes in a string?

I need to write a string literal to a text file, but the C# compiler finds errors when I use quote characters in it. My current code: writeText.WriteLine("<?xml version="1.0" encoding="utf-8"?>"); I need the output for the text file to be: <?xml version="1.0" encoding="utf-8"?> How can I put quote characters in strings in C#? ...

Why strings behave like ValueType

I was perplexed after executing this piece of code, where strings seems to behave as if they are value types. I am wondering whether the assignment operator is operating on values like equality operator for strings. Here is the piece of code I did to test this behavior. using System; namespace RefTypeDelimma { class Program {...

update columns when value is numeric in tsql

i want to normalize date fields from an old badly designed db dump. i now need to update every row, where the datefield only contains the year. update table set date = '01.01.' + date where date like '____' and isnumeric(date) = 1 and date >= 1950 but this will not work, because sql does not do short circuit evaluation of boolean expr...

Parse error: syntax error, unexpected T_STRING in...

I' making this class to catch twitter posts but I get the error : Parse error: syntax error, unexpected T_STRING in /Applications/XAMPP/xamppfiles/htdocs/classTest/Twitter.php on line 29 I cant find what's wrong...any ideas? class TwitterGrub{ function twitterCapture($user = 'myUsername',$password = 'myPass') { $ch =...

How to get only first words from several C++ strings?

I have several C++ strings with some words. I need to get first word from every string. Then I have to put all of them into a char array. How can I do it? Thanks i advance! ...

Trying to reference a hash using a string value in Ruby

How would I refer to a hash using the value of a string - i.e. #!/usr/bin/env ruby foo = Hash.new bar = "foo" "#{bar}"["key"] = "value" results in foo:5:in `[]=': string not matched (IndexError) from foo:5 How do I use the value of bar (foo) to reference the hash named foo? Thanks! ...

How to concatenate 2 LPOLESTR

Hi, i want to concatenate 2 strings in c++, i can't use char*. I tried the following but doesn't work: #define url L"http://domain.com" wstring s1 = url; wstring s2 = L"/page.html"; wstring s = s1 + s2; LPOLESTR o = OLESTR(s); I need a string with s1 and s2 concatenated. Any info or website that explain more about this ? Thanks. ...

Can IDL evaluate strings as code?

Is there any functionality in IDL that will allow it to evaluate a a string as code? Or, failing that, is there a nice, dynamic way of including /KEYWORD in functions? For example, if I wanted to ask them for what type of map projection the user wants, is there a way to do it nicely, without large if/case statements for the /Projection_...

String Format not working

I am trying to display a number, stored in a dataset as a string, as a phone number. I have a label that Binds to a value but doesn't display the format that I passed as an arg: <asp:Label ID="lbl005108002" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "phone number", "{0:(###) ###-####}") %>'></asp:Label> As a test I t...

The best alternative for String flyweight implementation in Java

My application is multithreaded with intensive String processing. We are experiencing excessive memory consumption and profiling has demonstrated that this is due to String data. I think that memory consumption would benefit greatly from using some kind of flyweight pattern implementation or even cache (I know for sure that Strings are o...

PHP What is the best way to get the first 5 words of a string?

What is the best way to get the first 5 words of a string? How can I split the string into two in such a way that first substring has the first 5 words of the original string and the second substring constitutes the rest of the original string ...

Query String checks checkbox on different page

Hello I'm having a problem, I have a button on page1 that when clicked passes this url: http://www.example.com/page1.html?jquery=blogger once it's clicked will go to page2 where there are checkboxes. I need the checkbox associated with "blogger" (named: cf_538) to be checked once the page loads. <script type="text/javascript"> <!-- ...

immutable strings vs std::string

I've recent been reading about immutable strings, here and here as well some stuff about why D chose immutable strings. There seem to be many advantages. trivially thread safe more secure more memory efficient in most use cases. cheap substrings (tokenizing and slicing) Not to mention most new languages have immutable strings, D2.0,...

Remove a character from a given position on Oracle

Is there anyway to remove a character from a given position? Let's say my word is: PANCAKES And I want to remove the 2nd letter (in this case, 'A'), so i want PNCAKES as my return. Translate doesnt work for this. Replace doesnt work for this. Regex is damn complicated... Ideas? ...

std::out_of_range error?

I'm dealing with a file with a linked list of lines with each node looking like this: struct TextLine{ //The actual text string text; //The line number of the document int line_num; //A pointer to the next line TextLine * next; }; and I'm writing a function that adds spaces at the beginning of the lines found i...

C - range of characters in a string

Is there a function to get a range of characters in a text string or would i need make my own? ...

Actionsript/Flex String replace for <

I have a string like "My <color>" I want to replace "<color>" with "Orange". I did str = str.replace("<color>","Orange"); but it doesn't work. How to do it? ...