ich eine ganze Zahl in eine Zeichenfolge in Julia konvertieren möchten.Konvertieren Integer in String in Julia
Wenn ich versuche:
a = 9500
b = convert(String,a)
ich den Fehler:
ERROR: LoadError: MethodError: Cannot `convert` an object of type Int64 to an object of type String
This may have arisen from a call to the constructor String(...),
since type constructors fall back to convert methods.
in include_from_node1(::String) at ./loading.jl:488
in process_options(::Base.JLOptions) at ./client.jl:265
in _start() at ./client.jl:321
while loading ..., in expression starting on line 16
Ich bin nicht sicher, warum Int64 die nicht in Strings umgewandelt werden können.
Ich habe versucht, a
als verschiedene Typen zu definieren, zum Beispiel a = UInt64(9500)
, aber ähnliche Fehler erhalten.
Ich weiß, das ist sehr einfach und habe versucht, auf der Suche nach dem richtigen Weg here, aber konnte es nicht herausfinden.
[any use] (https://en.wikibooks.org/wiki/Introducing_Julia/Strings_and_characters)? – daycaster
Duplizieren von [Wie jede Art in String in Julia konvertieren] (http://stackoverflow.com/questions/41929009/how-to-convert-any-type-into-string-in-julia). Abstimmung zum Schließen. –