Menu
  • HOME
  • TAGS

How can I convert multiple arrays into one single variable string?

php,arrays,string,concatenation

This should work for you: Just loop through all 3 arrays at once with array_map(). So first you transpose your array into this format: Array ( [0] => a1, b1, c1 [1] => a2, b2, c2 [2] => a3, b3, c3 [3] => a4, b4, c4 [4] => a5, b5,...

Concatenating elements from two arrays of same indexes

perl,concatenation

To repeat the process for n elements in the array, you can do the following my @x=(1,2,3,4); my @y=(5,6,7,8); my @concatenated_array=(); for my $i (0 .. $n) # define $n <= min($#x,$#y) { push @concatenated_array, $x[$i] ."_". $y[$i]; } print "@concatenated_array\n"; ...

Optimise string building with concatenation in PHP loop

php,arrays,for-loop,parameter-passing,concatenation

Let's define your requirement first: You need to insert 1000 records, record being defined in an array It should be fast An insert could fail so it has to be repeated First problem is that you are dealing with a database here. Modern MySQL uses InnoDB as storage engine -...

Read Multiple Text Files based on dated name and write all to concatenate string

php,string,file,concatenation

Your code as you mentionned overwrite the content of $date variable at each iterations so when you run $file = file_get_contents('idfilebuy'.$datef.'.txt'); $datedef on contain the last while iterations. You need to retreive each file inside your while statement. $string = ''; while (strtotime($date) <= strtotime($end_date)) { $datef="$date"; $fileContent = file_get_contents('idfilebuy'.$datef.'.txt');...

Best way to detect changes when values might not exist anymore?

javascript,jquery,jquery-ui,comparison,concatenation

At var initialValues = $(.myNewClass).map(Function(x){ return x.val() }) .myNewClass should be a String , within quotes $(".myNewClass") . F at .map() callback should be lowercase f , to prevent calling native Function . x at first parameter of .map(x) would be the index of the element or object within the...

VB.net txt text file merge / concatenate all files

vb.net,text-files,concatenation

Apologies it was a rookie error the text reader was corrupt i have just re installed it. Sorry if i have wasted your time.

Issues concatenating in Arrayfun with GPU processing. MATLAB

matlab,concatenation,gpu

In this case, you can simply recast the whole problem as a multiple-right-hand-side call to \, like so: %# with A,B,C,D defined as per question AA = [10 11 ; 20 8 ; 30 30 ; 40 30]; x = [A(:)'; B(:)'; C(:)'; D(:)']; x1x2 = AA \ x; X1...

TypeError: cannot concatenate 'str' and '_sre.SRE_Match' objects

python,regex,concatenation

regex is not a string. It is a Match Object representing the match. You'll have to pull the matched text: fundleverage = "+" + regex.group(1) + "0" Note that your expression matches either a digit with a capital X or it matches a lowercase x (no digit). In your case...

How to concatenate a String with AnyObject in Swift?

string,swift,concatenation,string-concatenation

You can use "\(yourVariableHere)" format to treat them as string. var domain:AnyObject = "http://www.yourdomain.com/" var parameter:AnyObject = "?id=5" let url:NSURL = NSURL(string: "\(domain) \(parameter)") More info on Strings let string1 = "hello" let string2 = " there" var welcome = string1 + string2 ...

Difference in time between list append and + operator that I can't explain

python,list,append,concatenation

What's happening here is that you exhausted the file object. A file object uses a current file position to read the next bytes from the file, and looping over a file reads from the file until the end. Your second loop then yields no results as the file is still...

Concatenate two double arrays into a n x 1 cell array using matlab

arrays,matlab,matrix,concatenation,cell

Try this one-liner: out = mat2cell([A,repmat(B,numel(A),1)],ones(numel(A),1),2) Sample run: A = [1234; 1235; 1236; 1237; 1238]; B = [4567]; Results: out = [1x2 double] [1x2 double] [1x2 double] [1x2 double] [1x2 double] If you want as 1xn cells, you could just transpose the output out = out.' %//' out = [1x2...

SQL count date time

sql,count,concatenation

Yes you will need subquery: select * from (select someExpression as Requiredby FROM [dbo].[Main] where Location = 'Home' and ScriptTypeID = '1') t where Requiredby < GETDATE() But I really think you want this: select sum(case when cast(cast(DischargeDatenew as date) as datetime) + cast(DischargeTime as time) < getdate() then 1...

Mapping separate fields into one string using Automapper

c#,string,field,concatenation,automapper

Maybe, it's just me, but (there's always a but), what is the question? I think it's already converted, you just missing the code to actually mapping the source entity and display the result to monitor, like this: AddressSearchResponseDto result = Mapper.Map<Address,AddressSearchResponseDto>(source); Console.WriteLine(result.newAddress); ...

Concatenate string via XAML

wpf,xaml,concatenation,string.format

Use a TextBlock instead. <ProgressBar Value="50" Name="prog" ... /> <TextBlock Text="{Binding Path=Value, ElementName=prog, StringFormat={}{0}%}"/> ...

Numpy concatenate 2D arrays with 1D array

python,arrays,numpy,concatenation

Try concatenating X_Yscores[:, None] (or A[:, np.newaxis] as imaluengo suggests). This creates a 2D array out of a 1D array. Example: A = np.array([1, 2, 3]) print A.shape print A[:, None].shape Output: (3,) (3,1) ...

Concatenate cells into a string with separator pandas python

python,string,pandas,concatenation

In [68]: df['new_col'] = df.apply(lambda x: '*'.join(x.dropna().values.tolist()), axis=1) df Out[68]: col1 col2 col3 new_col 0 a ab w a*ab*w 1 b NaN e b*e UPDATE If you have ints or float you can convert these to str first: In [74]: df = pd.DataFrame({'col1' : ["a","b",3], 'col2' : ["ab",np.nan, 4], 'col3'...

Java: Why does my book start concatenating string vars with concatenation with an empty string, specifically using System.out.print()?

java,string,concatenation

Your book is going a little overboard trying to avoid the complex rules that decide when + means concatenation and when it means addition. As an exercise, compare the following outputs: System.out.println(1 + 2); System.out.println("" + 1 + 2); EDIT: Just noticed the quote about ensuring "printing of characters". Is...

Click reinserts looped elements twice

javascript,jquery,loops,concatenation

You are appending string without emptying it first, try this: $(document).ready(function () { var endString = ""; $('#produce').click(function () { var myTxtArea = document.getElementById('KWarea'); myTxtArea.value = myTxtArea.value.replace(/^\s*|\s*$/g, ''); var lines = $('#KWarea').val().replace(/\*/g, '').split('\n'); endString =''; for (var i = 0; i < lines.length; ++i) { endString += '"*' + lines[i]...

Concatenate cells flexibly

matlab,concatenation

Create an array of structs to get rid of Block* fields and then reference the onsets field in resulting aray to get a comma-separated list and use vertcat: Q = structfun(@deal, P); all_onsets = vertcat(Q.onsets); ...

SQL Server controlling spaces when concatenating

sql-server,sql-server-2008,concatenation

An easier way: SELECT COALESCE(Field1 + ' ' + Field2, Field1, Field2, '') FROM Table This also avoid changes of LTRIM and RTRIM over fields. But for more fields I use: SELECT SUBSTRING(ISNULL(Field1, '') + ISNULL(' ' + Field2, '') + ISNULL(' ' + Field3, '') + ISNULL(' ' +...

Use php variable in sql statement with concatenation

php,sql,string,variables,concatenation

You can create a new variable table_name and add your concatenated databasename.tablename to that variable like var table_name = '[email protected]_database.p'.$storecode.'081' Then in your query you can use this variable as "SELECT mydate from ".$table_name; I m not php developer this is just for idea i m sharing the code based...

String concatenation in perl to a variable

perl,concatenation

This will do what you require. use strict; use warnings; my $masterP = "A:B:C a:b:c a:c:b A:C:B B:C:A"; my @scen = split ' ', $masterP; my @try = map { join '_', (split /:/)[0,1] } @scen; my $try = "@try"; print "$try\n"; output A_B a_b a_c A_C B_C ...

using range in CONCATENATE function

excel,range,concatenation,libreoffice,calc

Unfortunately the Excel CONCATENATE function doesn't work for a range or array (it does in Google Sheets). There is an example here of a simple UDF that does work with arrays in Excel....

Bash string concat does not work - Result of concat is empty

string,bash,concatenation

Because you're using a pipe, the while loop is run in a subshell, so when that subshell exits, its variables disappear with it. You're left with the $OUTPUT variable from the parent shell which is empty. You have to ensure you build up OUTPUT in the parent shell: while read...

Concatenate two big numpy 2D arrays

python,arrays,numpy,concatenation

Unless there's something wrong with your NumPy build or your OS (both of which are unlikely), this is almost certainly a memory error. For example, let's say all these values are float64. So, you've already allocated at least 18GB and 20GB for these two arrays, and now you're trying to...

Split string and append to array

ruby,string,split,concatenation

mystrings = ['abc:def', 'ghi:jkl', 'mno:pqr'] first, second = mystrings.map{|str| str.split(":")}.transpose ...

Get values of mySQL rows in PHP and echo multiple values of certain rows

php,mysql,concatenation,concat

You could try something like this. Basically grabbing a from the results you got for a specific book and then looping through the locations should work. (I know it's a little clunky but it should do the job). The problem you are having above is because you are only kicking...

String concatenation, error

c++,string,concatenation

You should write at least like string Container::tostring() { cadena= "("+ std::to_string( this->id ) + "," + std::to_string( this->weight ) + "," + std::to_string( this->price ) + ")"; return cadena; } Another way is the following #include <sstream> //... string Container::tostring() { std::ostringstream os; os << "(" << this->id <<...

R: Concatenate values of list components by another list defining which ones go together

r,list,indexing,concatenation

Try lapply(lst1, function(x) sort(unique(unlist(lst2[x], use.names=FALSE)))) If we don't need to sort and get the unique values lapply(lst1, function(x) unlist(lst2[x], use.names=FALSE)) #[[1]] #[1] "1" "2" "3" "5" "6" "1" "3" "4" "5" "6" "7" #[[2]] #[1] "a" "b" "c" "d" "e" #[[3]] #[1] "1" "2" "3" "1" "2" "3" "4" "5"...

Best Practice for Including Javascript and Concatenate

javascript,module,include,concatenation,gulp

Ok, I just spoke with another developer and we mainly told me the following way is the way to go: write different .js files with different modules (my own code separation for better maintenance) all of them including their own immediately invokin function expression to prohibit scope problems and their...

How to concat to access cell using vb.net

sql,vb.net,ms-access-2010,concatenation

The correct syntax for an Update query is UPDATE tablename SET field=value, field1=value1,.... WHERE condition Then you need to remove that INTO that is used in the INSERT queries Dim db As String = "Update Equipment set TypeItem = .... " & "WHERE EquipmentCat = @category" After fixing this first...

List Concatenation, Adding elements that finish with ':' to a list, and others to a sublist

python,list,python-3.x,concatenation

Why you split your word first and put them within a list? you can directly loop over your line and split them with one nested list comprehension : import re with open('data.txt', 'r') as f : [[k,[p,n.split('|')]] if '|' in n else [k,[p,n]] for k,(p,n) in [[i,j.split(',')] for i,j in...

Vector concatenation in MATLAB

matlab,vector,concatenation

It's very simple: new_vector = [s_i{bits}] ...

split string column by “_”, drop the preceding text, recombine str by “_” in pandas

python,pandas,concatenation,dataframes

You could use apply like this : In [1782]: df[0].apply(lambda v: '_'.join(v.split('_')[1:])) Out[1782]: 0 toronto_maple-leafs_Canada 1 boston_bruins_US 2 detroit_red-wings 3 montreal Name: 0, dtype: object In [1783]: df[0] = df[0].apply(lambda v: '_'.join(v.split('_')[1:])) Surprisingly, applying str seem to be taking longer than apply : In [1811]: %timeit df[0].apply(lambda v: '_'.join(v.split('_')[1:])) 10000...

What is the usage of adding an empty string in a javascript statement

javascript,string,concatenation

Type Casting. It converts the type to string If variable current.condition_field is not of string type, by adding '' at the end of it converts it to string. var field = current.condition_field + ''; So, field is always string. Thanks to @KJPrice: This is especially useful when you want to...

Comparing Columns in Multiple Excel Tabs using INDIRECT

excel,concatenation,excel-indirect

You are trying to use Concatenate to append all cells in a range. That will not work. Concatenate needs individual arguments, not a range. For such a comparison you would need an array formula. Select all cells from C7 down to C100 (or however many rows you will need for...

Why in C++ when i concat a string with '+' like it don't concat but remove first char of the string [duplicate]

c++,string,concatenation,cout

This is how pointer arithmetics work in C/C++. Basically, "Hello world!" is just a const char* and its + operator works on it like a pointer. Which means that, for example, if you add 3 to it, then instead of pointing to the beginning of "Hello world" it will point...

Inserting tuples in a list Ocaml

list,tuples,ocaml,concatenation

Your definition of l means that l is immutable. You define its value as [], and this can never be changed. If you want to be able to change l, you need to define it as a mutable value. One simple way to do this is to make it a...

c++ concatenating macro definitions

c++,macros,concatenation,preprocessor

Yes, you can concatenate macro replacements with the ## preprocessor directive and some auxiliary quoting macros. #define _LOAD _mm256_load #define _FLOAT ps #define CAT(X, Y, Z) X ## Y ## Z #define CMB(A, B) CAT(A, _, B) #define FOO CMB(_LOAD, _FLOAT) Now use FOO, or just CMB(_LOAD, _FLOAT) directly....

concatenation with multiple quotes while displaying html using PHP [duplicate]

php,html,concatenation

Make sure you dont use ' and " in the same way, this should work: echo "<form class='navbar-form navbar-left' role='search' method='POST' action='addr3.php'> <input type='hidden' name='id_delete' value='".$id_r."'> <button type='submit' class='btn btn-primary'> I am Roaming </button> </form>"; ...

Concatenate excel cells with numbers without summing

r,excel,concatenation

You can use the & sign =A1&C1 concatenate does also work in excel =CONCATENATE(A1,C1) ...

Matlab: how can I create one grid by joining two gridded rectangles of different size (or two matrices with different dimensions)?

matlab,concatenation

I think you will need to take a slightly different approach here. Create your meshgrid() such that the X and Y values completely contain all parts of the tank and intake. Your last line seems fine. Next you'll have to create an additional masking matrix the size of X (or...

concatenation of distinct substrings

java,string,out-of-memory,substring,concatenation

With the constraints you are given (up to 105 characters) you shouldn't be having out-of-memory problems. Perhaps you were testing with very big strings. So in case you have, here are some places where you are wasting memory: After you fill the set, you copy it to your list. This...

concatenating string and int for filename in cpp

c++,string,loops,concatenation

The string and int concatenation works generally but not when I want it to be a filename. It has nothing to do with concatenating strings. Your compiler doesn't support C++11, which means you cannot pass an std::string as argument to std::ofstream::open. You need a pointer to a null terminated...

MATLAB - Adding a field to the begining of an existing struct

matlab,data-structures,struct,concatenation

The orderfields function exists for this purpose: % Order based on permuting current field ordering DB = struct('StudyDate','2015/04/27','StudyTime',now(),'PatientName','Baz Bar'); DB.PatientID = dec2hex(randi([1,2^32])); DB = orderfields(DB,[4,1,2,3]); % Does the same with explicit fieldnames DB = struct('StudyDate','2015/04/27','StudyTime',now(),'PatientName','Baz Bar'); DB.PatientID = dec2hex(randi([1,2^32])); DB = orderfields(DB,{'PatientID','StudyDate','StudyTime','PatientName'}); ...

Find Biggest Concatenation Word in List

c#,arrays,concatenation

Try this: string[] words = { "five", "fivetwo", "fourfive", "fourfivetwo", "one", "onefiveone", "two", "twofivefourone" }; var allCombinations = words.SelectMany(w => words, (left, right) => left + right); var combinedWords = words.Where(w => allCombinations.Contains(w)); string longestCombinedWord = combinedWords.OrderByDescending(w => w.Length).First(); Console.WriteLine(longestCombinedWord); ...

php form mail function

php,email,variables,concatenation

As I mentioned in comments, you're overthinking this and there are a few simpler ways to go about this. Either by changing your whole block to: (no need for all those variables) $mail = " <h1> </h1><h2>Afzender:</h2><p> ( )</p><h2>Bericht:</h2><p> </p> "; then mail("$myEmail","$emailOnderwerp",$mail,... But, if you wish to continue using...

Concatenate a number to url everytime I click on the button?

javascript,string,numbers,concatenation,concat

Put your cConcate inside button click event as it should get updated. Change your code to var tNumber = 1; var sSting = "http://www.test.com/"; var cConcate = sSting; $("button").click(function(){ tNumber++; cConcate= cConcate + tNumber; console.log(cConcate); console.log(tNumber); }); Or if you want to append only one number: var tNumber = 1;...

Concat Program, Weird symbols

c++,concatenation

The problem's here: //attach terminating null szTarget[targetIndex] = '/0'; The character literal should be '\0'. The notation's a backslash followed by one to three octal digits: that creates a character with the encoded value. char(0) == \0 is the ASCII NUL character used to delimited "C-style" aka ASCIIZ character strings....

MYSQL - append or insert value into a column depending on whether it's empty or not

php,mysql,string,concatenation

https://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html That means in your case: INSERT INTO tablename (id,columnname) VALUES (1,'//string') ON DUPLICATE KEY UPDATE columnname=CONCAT(columnname,'//string'); http://sqlfiddle.com/#!9/bd0f4/1 UPDATE Just to show you your options: http://sqlfiddle.com/#!9/8e61c/1 INSERT INTO tablename (id, columnname) VALUES (1, '//string') ON DUPLICATE KEY UPDATE columnname=CONCAT(columnname,'//string'); INSERT INTO tablename (id, columnname) VALUES (1, '//string') ON DUPLICATE KEY...

Array stacking/ concatenation error in python

python,arrays,numpy,concatenation

Try b = np.expand_dims( b,axis=1 ) then np.hstack((a,b)) or np.concatenate( (a,b) , axis=1) will work properly. ...

appending two variables in php having `$` symbol in the appending string

php,concatenation

Use variable variable names: $varName = 'row' . $i . 'val'; $row[ $$varName ]; ...

Concatenate variable argument list

java,concatenation,java-7,varargs,variableargumentlists

There isn't a way around creating a new String[], like so: public String myMethod(String... args) { String[] concatenatedArray = new String[args.length + 1]; concatenatedArray[0] = "other string"; for (int i = 0; i < args.length; i++) { // or System.arraycopy... concatenatedArray[i + 1] = args[i]; } return myOtherMethod(concatenatedArray); } Or,...

Rust - String concatenation [duplicate]

string,concatenation,rust

First, in Rust x += y is not overloadable, so += operator won't work for anything except basic numeric types. However, even if it worked for strings, it would be equivalent to x = x + y, like in the following: res = res + format!("{} {}\n",i.to_string(),ch.to_string()) Even if this...

DataColumn: combine columns and values into a string

c#,linq,concatenation,value,datacolumn

I think you are trying to get the column names and rows without actually referencing them. Is this what you're trying to do: var table = new DataTable(); var column = new DataColumn {ColumnName = "column1"}; table.Columns.Add(column); column = new DataColumn {ColumnName = "column2"}; table.Columns.Add(column); var row = table.NewRow(); row["column1"]...

Behaviour of null in Java

java,nullpointerexception,null,concatenation

String has a lot of special allowances in Java, for better or for worse. The specification dictates that null gets converted to the string "null" when converted to a string, e.g. by string concatenation (which implicitly calls toString() on other operands). So adding null to a string works by virtue...

concatenate two byteBuffers to a single

java,concatenation,bytebuffer

You can do it like this ByteBuffer b3 = ByteBuffer.allocate(b1.limit() + b2.limit()); b3.put(b1); b3.put(b2); ...

Combine 2D matrices to form 3D one in Matlab

arrays,matlab,concatenation

Using cat to concatenate along the third dimension might be the elegant way - D = cat(3,A,B,C) Here, the first input argument 3 specifies the dimension along which the concatenation is to be performed....

Get concatenate string of multiple value variable in Javascript

javascript,jquery,concatenation

DEMO -> http://jsfiddle.net/0d54ethw/ Use querySelectorAll instead of querySelector since the latter only selects the first element as opposed to all of them. Then use for loop as shown below var getSelected = document.querySelectorAll('[data-attr~="sel"]'); var selectedNums = []; for (var i = 0; i < getSelected.length; i++) { selectedNums.push(getSelected[i].dataset.num); } alert(selectedNums.join(','));...

Android carriage return inside concatenated string

android,textview,concatenation,carriage-return

Try with TextView.setText("Tag is :\n" + result); or if necessary TextView.setText("Tag is :\n" + result.replaceAll("[^\\w]+", " ")); It just replaces any group of character which are not letter or digit by a space....

Find biggest concatenation word in array

c#,concatenation

Update 3 In order to fix the second compile error (see Update 2), you need to remove from the list without doing so via Iterator, which has no remove method. One way would be the following, which saves up the indexes for removal after traversal by the iterator. Note that...

bash: How can I assemble the string: `“filename=output_0.csv”`

string,bash,concatenation

An answer was posted, which I thought I had accepted already, but for some reason it has been deleted, possibly because it didn't quite answer the question. I posted another similar question, and the answer to that helped me also answer this question. You can find said question and answer...

Creating new complex index with pandas Dataframe columns

python,indexing,pandas,concatenation,dataframes

#dummying up a dataframe cf['A'] = 5*[5] cf['C'] = range(5) cf['B'] = list('qwert') #putting together two columns into a new one -- EDITED so string formatting is OK cf['D'] = map(lambda x: str(x).zfill(5), 1000*cf.A + cf.C) # use it as the index cf.index = cf.D # we don't need it...

String Concatenation Operator + Ambiguity

string,operator-overloading,operators,concatenation,language-design

If you're worried about that (which you should be), then define it. Python has a concept of a reverse-operator in addition to the normal forward-operators. There is a defined method by which these work. C++ takes the approach of "there's no such thing as a reverse-operator, but things can be...

How to join second line to end of first line in python?

python,python-2.7,join,replace,concatenation

Read the entire file as a single string, then replace the entire whitespace with a single tab: filepointer = open("INPUT.txt") text = filepointer.read() text = re.sub(r"\n\s{20,}", "\t", text) This matches and removes sequences of a newline followed by 20 or more spaces, replacing them with a tab. (That way I...

Concatenate plain char and string?

c++,string,char,concatenation

To concatenate string literal and char: std::string miString = std::string("something") + c; A similar thing happens when you need to concat two strings literals. Note that "something" is not a std::string, it is a pointer to an array of chars. Then you can't concatenate two string literals using +, that...

Concatenation of strings array issues in Python: Str(ArrayOfString[1])+“ ”+Str(ArrayOfString[2]) doesn't seem to work

string,python-2.7,concatenation,slice,string-length

Just change your first attempt to following: if len(str(row[1])) >= 16: row[2] = str(row[1])+" "+str(row[2]) row[1] = str(row[1][0:16]) My answer is freely adapted from comment by @phylogenesis. Update: The above answer wont work because row is a tuple and hence it is immutable. You will need to assign the values...

Mysql Many to Many with Mapping table return one row and concatenate the values that would cause duplicate rows

php,mysql,many-to-many,concatenation

You can make use of INNER JOIN and GROUP_CONCAT, see example below:- SELECT E.id, E.name, GROUP_CONCAT(O.name) OfficialName FROM Mapping M INNER JOIN Event E ON M.eid = E.id INNER JOIN Official O ON M.oid = O.id GROUP BY E.id ...

How to console.log an object definition and a text in same string?

javascript,object,concatenation,console.log

console.log accepts any number of parameters, so just send each piece as its own param. That way you keep the formatting of the object in the console, and its all on one entry. var obj = { query: 'wordOfTheDay', title: 'Frog', url: '/img/picture.jpg' }; console.log( "Text Here", obj); // Text...

Python 3.x - Using the sum function to concatenate strings in a list

python,python-3.x,sum,concatenation

This doesn't work. sum() is for adding up numbers, not strings. Use ''.join() instead. >>> ''.join(['good ', 'morning']) 'good morning' ...

How to bit-shift and concatenate to get correct result?

c#,concatenation,bit,bit-shift,uint16

I already tried to (logically) bit-rightshift r[0] by 8, but then the upper bits get lost because they are stored in the first 8 bits of r[1]. Well they're not "lost" - they're just in r[1]. It may be simplest to break it down step by step: byte val1LowBits...

Red-Black tree: Split/Concatenate in log(n) time

algorithm,split,concatenation,binary-search-tree,red-black-tree

In future. If any have the same problem again: Tarjan have some important differences in the algorithm compared to what Ron Wein does. I still haven't been able to see that Wein is correct in his algoritm, but Tarjan is. So I suggest you use his instead. First important point...

How to cleanly use: const char* and std::string?

c++,string,char,concatenation

One of the simplest solution is to use an C++ empty string. Here I declare empty string variable named _ and used it in front of string concatenation. Make sure you always put it in the front. #include <cstdio> #include <string> using namespace std; string _ = ""; int main()...

Is concatenation inside an ini file possible?

php,concatenation,ini

INI files does not allow you to include any logic, but you can do it by being tricky. Define upload_path as upload_path=root.path,tree.upload. Then in PHP read a value, and do some splitting: $parts = explode(",",$uploadPath); Now you will have and array that will look like this: ['root.path', 'tree.upload']. Now in...

in php concatenation of '<' with any string becomes empty string

php,string,concatenation

These is problem of TAGs that being skipped by Web Browser to display. You can display by converting '<' to "&lt". PHP has built-in functions for such problem, String functions Search for 'HTML' in this page, you will get 4-5 functions that will help you. Hope that helps !!...

How do I prepend/append (concatenate) data to each row in a MySQL result or data set?

mysql,concatenation

Use CONCAT(): SELECT CONCAT('sku', sku, 'a') AS new_sku FROM items ...

How to expand a string within a string in python?

python,string,dictionary,concatenation,list-comprehension

You can do this using split and simple list comprehension: def expand_input(input): temp = input.split("*") return [temp[0]+x for x in temp[1:]] print(expand_input("yyy*a*b*c")) >>> ['yyya', 'yyyb', 'yyyc'] ...

Concatenate shows the second and third value except the first value

excel,excel-vba,concatenation

Edit: Added new code. It is hard to run the code as nobody but you has the workbook, and we would have to try and reproduce the workbook ourselves. Here is a revised code as I have interpreted what you are trying to do. I cannot test it as I...

How can I convert and integer into a string? [duplicate]

python,string,integer,concatenation

To answer to the question in the title, you can convert an integer into a string with str. But the print function already applies str to its argument, in order to be able to print it. Here, your problem comes from the fact that a is a string while b...

C Preprocessor generate macros by concatenation and stringification [duplicate]

c,concatenation,c-preprocessor,stringification

This seems to work: #define I2C_MODULE 1 //Alias macros (conceptual form): //#define I2C_MODULE_BASE I2C<Value of I2C_MODULE>_BASE //#define I2C_MODULE_NVIC INT_I2C<Value of I2C_MODULE> //Target macros (from an external file out of my control): #define INT_I2C0 24 #define INT_I2C1 53 #define I2C0_BASE 0x40020000 #define I2C1_BASE 0x40021000 #define PASTE2(a, b) a ## b #define...

Concatenating positions into genomic segments

r,concatenation,bioinformatics,bioconductor,genome

I couldn't think of any pretty solution using basic dataframe manipulation, so here's a bad-looking one that works: First, add stringsAsFactors to df creation: df <- read.table(text=df, header=T, stringsAsFactors = FALSE) start <- df$Position[1] end <- integer() output <- NULL count <- 1 for (i in 1:(nrow(df)-1)) { if(df$Bel[i] <...

Concatenate values when greater than 0

sql,sql-server,database,concatenation

select Case When Video > 0 Then Video + ' Video|' else '' end + Case When Internet > 0 Then Internet + ' Internet|' else '' end + Case When Phone > 0 Then Phone + ' Phone|' else '' end + Case When Security > 0 Then Security...

How to concatenate a string and an integer

c++,string,concatenation

You can use std::to_string to create std::string from your int values string s1 = std::to_string(h) + ":" + std::to_string(m) + ":" + std::to_string(s); Remember you have to return from your function! string whatTime(int n) { int h = n / 3600; int m = n / 60; int s =...

concatenating a uint8_t array into uint32_t array in C

c,arrays,concatenation

If you really are working with decimal values: uint32_t dst[] = {1000000 * src[0] +10000 * src[1] + 100 * src[2] + src[3], 1000000 * src[4] +10000 * src[5] + 100 * src[6] + src[7]}; ...

Macro to merge and concatenate cells in Excel for rows in which information on other columns matches

excel,excel-vba,merge,concatenation

simply add this line in the code: Cells(i, 7).Value = Cells(i, 16).Text + Cells(i + 1, 16).Text complete code: Sub merge() Dim i As Long Dim j As Long Dim sameRows As Boolean sameRows = True For i = 1 To Range("A" & Rows.Count).End(xlUp).Row For j = 1 To 6...

“Merging two files” using operator “+”

c++,file,operator-overloading,concatenation

C++ does not provide some magical handling for your abstract logic, it cannot just work out that File1=File2+File3 means you want to merge two files together. Firstly, those variables would have to be some form of 'type', and to have the logic you want, a type of your own devising....

Is it possible to call a variable by concatenating two strings in JavaScript?

javascript,variables,concatenation

You could define the attributes as properties of objects and access them using strings, like this: var player = { str: 1, dex: 1, in: 1, ht: 1, strCP: 10, dexCP: 10, intCP: 10, htCP: 10, totalCP: 0 }, costs = { strCost: 10, dexCost: 10, inCost: 10, htCost: 10...

How to merge files within a sub-directory and perform this function on mutliple sub-directories

python,bash,unix,concatenation

This should give you what you want, and can be customized to your needs: import os OLD_BASE = '/tmp/so/merge/old' NEW_BASE = '/tmp/so/merge/new' NEW_NAME = 'merged.txt' def merge_files(infiles, outfile): with open(outfile, 'wb') as fo: for infile in infiles: with open(infile, 'rb') as fi: fo.write(fi.read()) for (dirpath, dirnames, filenames) in os.walk(OLD_BASE): base,...

Add spaces and/or breaks in concatenated text from variables of values input fields in jQuery

jquery,variables,input,concatenation,value

In code shown...$('.changeFields').val() will only return the value of the first element in the matching selector. You need to loop over all of them if you want the values of all those elements. You can do this numerous ways such as $.each and concatenate strings on each iteration or my...

String Contatenation with primitives in java

java,string,variables,concatenation,primitive

The ASCII / Unicode value for 'H' is 72. The additions are processed left to right, so lchar + lbyte is 'H' + (byte) 3 which is equal to 72 + 3. You'll only get a string result from + if one of the operands is a string. That doesn't...

How to use join to fill missing values of a column - Python Pandas?

python,join,pandas,left-join,concatenation

You can use combine_first (only the columns names should match, therefore I first rename the column B in df2): In [8]: df2 = df2.rename(columns={'B':'A'}) In [9]: df1.combine_first(df2) Out[9]: A 12/1/14 3 12/2/14 20 12/2/14 20 12/3/14 2 12/4/14 30 12/6/14 5 ...

Concatenate two audio files in Swift and play them

swift,audio,concatenation,avaudioplayer,wav

I got your code working by changing two things: the preset name: from AVAssetExportPresetPassthrough to AVAssetExportPresetAppleM4A the output file type: from AVFileTypeWAVE to AVFileTypeAppleM4A Modify your assetExport declaration like this: var assetExport = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetAppleM4A) assetExport.outputFileType = AVFileTypeAppleM4A then it will properly merge the files. It looks like...

Should I use operator+= instead of operator+ for concatenating std::string?

c++,append,concatenation,stdstring

operator+= has the wrong kind of associativity for you to write code like your second example. For that to do what you want, you'd need to bracket it like so: (((myString += someString) += "text") += otherString) += "more text"; The alternative, which gives you the readability and efficiency you...

Oracle SQL TOAD - Update Year in a variable ( Concat string + Year ) depending of Sysdate

sql,oracle,date,concatenation

This query worked for test data: with a as (select 1970 var, to_char(sysdate, 'mm-dd') today from dual), b as (select case when today between '10-01' and '12-31' then to_date(var ||'-10-01', 'yyyy-mm-dd') else to_date(var-1||'-10-01', 'yyyy-mm-dd') end d1, case when today between '10-01' and '12-31' then to_date(var+1||'-09-30', 'yyyy-mm-dd') else to_date(var ||'-09-30', 'yyyy-mm-dd')...

How can I pass the result of a command to another command in one line?

bash,shell,command-line,concatenation,command-line-interface

Assuming that the number of minutes should be an integer rather than a string: my_cli --json '{"minutes" : '"$(( ( ( $(date +%s) - 18000 ) % 86400 ) / 60 ))"' }' ...

Create a new column in my SQL View - Column must be two other columns combined

sql,sql-server,tsql,concatenation

You simply need to add another column to your select: CREATE VIEW KFF_Rep_Comm AS SELECT vw_KLX_RepCommTrx.AccName AS AccountName ,vw_KLX_RepCommTrx.Account AS AccountNum ,vw_KLX_RepCommTrx.RepID ,vw_KLX_RepCommTrx.RepName ,vw_KLX_RepCommTrx.CommPerc AS CommPercent ,vw_KLX_RepCommTrx.Credit ,vw_KLX_RepCommTrx.Debit ,vw_KLX_RepCommTrx.MUPercent AS MarkUpPercent ,vw_KLX_RepCommTrx.ProfitPercent AS GrossProfitPercent ,vw_KLX_RepCommTrx.SgdTrxAmt AS InvValue ,vw_KLX_RepCommTrx.SgdCost AS Cost ,vw_KLX_RepCommTrx.SgdProfit AS GrossProfit...

SAS Concatenate Multiple Variables to Create Data-Driven Macro Statements

sql,macros,sas,append,concatenation

Answered my own question. This does what I need: DATA TEST1; SET TEST; STRING=COMPRESS(%NRSTR("%APPEND""("||COMPRESS(YEAR)||","||COMPRESS(CONDITION)||","|| COMPRESS(QRTS)||","|| COMPRESS(SAMPLE)||")"),""""); RUN; %APPEND can then be replaced by any macro name created, so this could be very useful. ...