Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia: concatenate string and integer

Tags:

What is the simplest way in Julia to concatenate a string and an integer value? I would like to do something like:

julia> foo = "test: " "test: "  julia> bar = 3 3  julia> foobar = foo * bar ERROR: `*` has no method matching *(::ASCIIString, ::Int64) 
like image 453
Thomas W. Avatar asked Jan 07 '15 19:01

Thomas W.


People also ask

How do you concatenate strings and variables in Julia?

Using '*' operator It is used to concatenate different strings and/or characters into a single string. We can concatenate two or more strings in Julia using * operator.

How do you concatenate text in CSS?

CSS performs concatenation without using any operator (e.g. +, &, etc). Keep your strings in quotes combine the strings, attr, var, etc into one line. Examples: url('not/very' '/useful/concatenation'); // not/very/useful/concatentation.

How do you join two strings together?

Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs.


1 Answers

I'm not terribly familar with Julia, but I believe you'd be better off with string interpolation:

"test: $bar" 

Or alternately:

string("test: ", bar) 

Or, if you did want to use the * operator, I believe you'd want:

"test: " * string(bar) 
like image 194
Joe Kington Avatar answered Sep 19 '22 14:09

Joe Kington