string-concatenation

Getting strings recognized as variable names in R

强颜欢笑 提交于 2019-11-27 06:03:10
Related: Strings as variable references in R Possibly related: Concatenate expressions to subset a dataframe I've simplified the question per the comment request. Here goes with some example data. dat <- data.frame(num=1:10,sq=(1:10)^2,cu=(1:10)^3) set1 <- subset(dat,num>5) set2 <- subset(dat,num<=5) Now, I'd like to make a bubble plot from these. I have a more complicated data set with 3+ colors and complicated subsets, but I do something like this: symbols(set1$sq,set1$cu,circles=set1$num,bg="red") symbols(set2$sq,set2$cu,circles=set2$num,bg="blue",add=T) I'd like to do a for loop like this:

Android TextView : “Do not concatenate text displayed with setText”

一笑奈何 提交于 2019-11-27 05:56:40
I am setting text using setText() by following way. prodNameView.setText("" + name); prodOriginalPriceView.setText("" + String.format(getString(R.string.string_product_rate_with_ruppe_sign), "" + new BigDecimal(price).setScale(2, RoundingMode.UP))); In that First one is simple use and Second one is setting text with formatting text. Android Studio is so much interesting, I used Menu Analyze -> Code Cleanup and i got suggestion on above two lines like. Do not concatenate text displayed with setText. Use resource string with placeholders. less... (Ctrl+F1) When calling TextView#setText: Never

How to concatenate strings in a Windows batch file?

我的未来我决定 提交于 2019-11-27 05:11:20
问题 I have a directory for which I want to list all the .doc files with a ; . I know the following batch command echos all the files: for /r %%i In (*.doc) DO echo %%i But now I want to put them all in a variable, add a ; in between and echo them all at once. How can I do that? set myvar="the list: " for /r %%i In (*.doc) DO <what?> echo %myvar% 回答1: What about: @echo off set myvar="the list: " for /r %%i in (*.doc) DO call :concat %%i echo %myvar% goto :eof :concat set myvar=%myvar% %1; goto

How to split string preserving whole words?

你离开我真会死。 提交于 2019-11-27 05:06:39
I need to split long sentence into parts preserving whole words. Each part should have given maximum number of characters (including space, dots etc.). For example: int partLenght = 35; string sentence = "Silver badges are awarded for longer term goals. Silver badges are uncommon." Output: 1 part: "Silver badges are awarded for" 2 part: "longer term goals. Silver badges are" 3 part: "uncommon." Try this: static void Main(string[] args) { int partLength = 35; string sentence = "Silver badges are awarded for longer term goals. Silver badges are uncommon."; string[] words = sentence.Split(' ');

Concatenating string and integer in python

微笑、不失礼 提交于 2019-11-27 05:02:40
问题 In python say you have s = "string" i = 0 print s+i will give you error so you write print s+str(i) to not get error. I think this is quite a clumsy way to handle int and string concatenation. Even Java does not need explicit casting to String to do this sort of concatenation. Is there a better way to do this sort of concatenation i.e without explicit casting in Python? 回答1: Modern string formatting: "{} and {}".format("string", 1) 回答2: No string formatting: >> print 'Foo',0 Foo 0 回答3: String

Why is the php string concatenation operator a dot (.)? [closed]

 ̄綄美尐妖づ 提交于 2019-11-27 04:26:38
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . In PHP, the string operator dot (.) is used to concatenate strings. For example: $msg = "Hello there, " . $yourName; The dot operator

Why does a null value appear in string output?

╄→гoц情女王★ 提交于 2019-11-27 04:07:44
问题 When I execute the following code the output is "nullHelloWorld". How does Java treat null? import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { String str=null; str+="Hello World"; System.out.println(str); } } 回答1: You are attempting to concatenate a value to null . This is governed by "String Conversion", which occurs when one operand

How to concatenate strings with padding in sqlite

限于喜欢 提交于 2019-11-27 02:53:15
I have three columns in an sqlite table: Column1 Column2 Column3 A 1 1 A 1 2 A 12 2 C 13 2 B 11 2 I need to select Column1-Column2-Column3 (e.g. A-01-0001 ). I want to pad each column with a - I am a beginner with regards to SQLite, any help would be appreciated tofutim The || operator is "concatenate" - it joins together the two strings of its operands. From http://www.sqlite.org/lang_expr.html For padding, the seemingly-cheater way I've used is to start with your target string, say '0000', concatenate '0000423', then substr(result, -4, 4) for '0423'. Update: Looks like there is no native

String concatenation vs. string substitution in Python

爷,独闯天下 提交于 2019-11-27 02:48:10
In Python, the where and when of using string concatenation versus string substitution eludes me. As the string concatenation has seen large boosts in performance, is this (becoming more) a stylistic decision rather than a practical one? For a concrete example, how should one handle construction of flexible URIs: DOMAIN = 'http://stackoverflow.com' QUESTIONS = '/questions' def so_question_uri_sub(q_num): return "%s%s/%d" % (DOMAIN, QUESTIONS, q_num) def so_question_uri_cat(q_num): return DOMAIN + QUESTIONS + '/' + str(q_num) Edit: There have also been suggestions about joining a list of

C++ equivalent of StringBuffer/StringBuilder?

允我心安 提交于 2019-11-27 02:31:13
Is there a C++ Standard Template Library class that provides efficient string concatenation functionality, similar to C#'s StringBuilder or Java's StringBuffer ? NOTE this answer has received some attention recently. I am not advocating this as a solution (it is a solution I have seen in the past, before the STL). It is an interesting approach and should only be applied over std::string or std::stringstream if after profiling your code you discover this makes an improvement. I normally use either std::string or std::stringstream . I have never had any problems with these. I would normally