string-concatenation

How do I insert a word into a string in Perl?

#!C:\Perl\bin\perl.exe use strict; use warnings; use Data::Dumper; my $fh = \*DATA; while(my $line = <$fh>) { $line =~ s/ ^/male /x ; print $line ; } __DATA__ 1 0104 Mike Lee 2:01:48 output male 1 0104 Mike Lee 2:01:48 Then I tried to insert male after the racenumber(0104), I replaced the code with style. $line...

Concat not work phpmyadmin (mysql)

hello, i want update my row and concat my string but i have an error with this query UPDATE FILE SET NOMFIC ='supp_'+D_NOMFIC WHERE IdFile = 2 ...

stringByAppendingFormat not working

I have an NSString and fail to apply the following statement: NSString *myString = @"some text"; [myString stringByAppendingFormat:@"some text = %d", 3]; no log or error, the string just doesn't get changed. I already tried with NSString (as documented) and NSMutableString. any clues most welcome. ...

Concatenation char and int

i've an error here , and couldn't solve it : String generate_card (String Fname , String Lname ,int card_id ){ String cardId = null ; cardId = Fname.charAt(0) + Fname.charAt(0) + card_id++ ; return cardId; } ...

SQL Server String Concatenation with Null

I am creating a computed column across fields of which some are potentially null. The problem is that if any of those fields is null, the entire computed column will be null. I understand from the Microsoft documentation that this is expected and can be turned off via the setting SET CONCAT_NULL_YIELDS_NULL. However, there I don't want ...

mysql: get all rows into 1 column

hi, i have 3 tables: post (id_post, title) tag (id_tag, name) post_tag (id_post_tag, id_post, id_tag) Lets suppose that id_post 3 has 4 linked tags 1,2,3,4 (soccer, basket, tennis and golf). Is there a way to return something like this in ONE row? col 1 id_post = 3 col 2 tags = soccer basket tennis golf Thanks ...

Path String Concatenation Question in C#.

Hello. I want to output D:\Learning\CS\Resource\Tutorial\C#LangTutorial But can't work. Compiler error error CS0165: Use of unassigned local variable 'StrPathHead Please give me some advice about how to correct my code or other better solution for my case. Thank you. static void Main(string[] args) { string path = "D:\\Learning\\C...

vb.net ampersand vs plus for concatenating string

In VB.Net, is there any advantage to using & to concatenate strings instead of +? e.g. Dim x as String = "hello" + " there" vs. Dim x as String = "hello" & " there" Yes, I know for a lot of string concatenations I'd want to use StringBuilder, but this is more of a general question. ...

Concatenating a string with the value of a NSTextField results in odd symbols in Objective-C

I'm in my second day of learning Objective-C, Cocoa and IB. This is probably something really simple but I cannot work it out. Basically, I have a form with a NSTextField, when the user types in this field and clicks an OK button the application will display an alert saying Hello followed by the value of text field. It's all working ap...

How slow is Python's string concatenation vs. str.join?

As a result of the comments in my answer on this thread, I wanted to know what the speed difference is between the += operator and ''.join() So what is the speed comparison between the two? ...

How should I concatenate strings?

Are there differences between these examples? Which should I use in which case? var str1 = "abc" + dynamicString + dynamicString2; var str2 = String.Format("abc{0}{1}", dynamicString, dynamicString2); var str3 = new StringBuilder("abc").Append(dynamicString).Append(dynamicString2).ToString(); var str4 = String.Concat("abc", dynamicS...

Performance with Perl Strings

I've been running across a lot of Perl code that breaks long strings up this way: my $string = "Hi, I am a very long and chatty string that just won't"; $string .= " quit. I'm going to keep going, and going, and going,"; $string .= " kind of like the Energizer bunny. What are you going to"; $string .= " do about it?"; From my backgr...

Regex Expression & string In C# Question.

Hello. I want to split my string s1 = 6/28/2010 4:46:36 PM and s2 = 16:46:36.5013946 . and concatenate them to new s3 = 20010062816463650. But when I split s2. my regex doesn't work. I was paused now. using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace ConAppTest { c...

Value Javascript Input

Hello, how can i transfer the Value from Input 1 in 2 and add some letters? <script type="text/javascript"> function doit(){ document.getElementById('input2').value=document.getElementById('input1').value; } </script> Input1: 2342 Input2: pcid2342d Can some one help me? ...

ruby - simplify string multiply concatenation

s is a string, This seems very long-winded - how can i simplify this? : if x === 2 z = s elsif x === 3 z = s+s elsif x === 4 z = s+s+s elsif x === 5 z = s+s+s+s elsif x === 6 z = s+s+s+s+s Thanks ...

C#: most readable string concatenation. best practice

Possible Duplicate: How should I concatenate strings? There are several ways to concat strings in everyday tasks when performance is not important. result = a + ":" + b result = string.Concat(a, ":", c) result = string.Format("{0}:{1}", a, b); StringBuilder approach ... ? what do you prefer and why if efficiency doesn't ma...

COBOL alternative to BASIC's MID and how to concat strings?

Hi, I'm looking for the COBOL alternative of Visual Basic's MID Function. The thing I need to do is take from 8 strings the first 5 letters and concatenate them. I'm using Fujitsu COBOL. Many thanks, Yvan ...

Why is there no exception when adding null to a string?

Why doesnt this throw an exception dont understand, obj is null object obj = null; Console.WriteLine("Hello World " + obj); ...

Concatenate two char arrays?

Hey all, If I have two char arrays like so: char one[200]; char two[200]; And I then want to make a third which concatenates these how could I do it? I have tried: char three[400]; strcpy(three, one); strcat(three, two); But this doesn't seem to work. It does if one and two are setup like this: char *one = "data"; char *two = "m...

StringBuilder or +=

Hello, I receive around 5 messages per second. Each of them has a string, which I concatenate to a master string that contains all the received messages string _masterText = ""; public void AddNewMessage(string text) // this is going to be call at least 5 times/second { _masterText += text; } Is this the ...