Stringing a string together!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Stringing a string together!

awood969
Hi guys,

I am wondering how you can pull different datatypes into a string, for example im trying to do the following with a StringMorph;

StringMorph contents: 'Text Stuff Here: ' + SmallInteger asString

Hard to explain myself but in PHP it would be;

$finalvalue = "Player: " + $myint;

and in C would be

cout << "Player: " << myint << endl;

Thanks!
Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Stringing a string together!

Richard Durr-2
You can't. You can, however, create a String representation:

StringMorph contents: 'Text Stuff here:' , aSmallInteger asString.

On Mon, Dec 6, 2010 at 9:31 PM, awood969 <[hidden email]> wrote:

Hi guys,

I am wondering how you can pull different datatypes into a string, for
example im trying to do the following with a StringMorph;

StringMorph contents: 'Text Stuff Here: ' + SmallInteger asString

Hard to explain myself but in PHP it would be;

$finalvalue = "Player: " + $myint;

and in C would be

cout << "Player: " << myint << endl;

Thanks!
Andrew
--
View this message in context: http://forum.world.st/Stringing-a-string-together-tp3075262p3075262.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Stringing a string together!

Enrico Schwass-2
In reply to this post by awood969
awood969 <[hidden email]> writes:

> I am wondering how you can pull different datatypes into a string, for
> example im trying to do the following with a StringMorph;
> StringMorph contents: 'Text Stuff Here: ' + SmallInteger asString
> Hard to explain myself but in PHP it would be;

StringMorph contents: 'Welcome ', 2 asString, ' Squeak'

Enno
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Stringing a string together!

awood969
In reply to this post by Richard Durr-2
thats exactly what i needed thank you very much :-D
Reply | Threaded
Open this post in threaded view
|

Re: Stringing a string together!

Levente Uzonyi-2
In reply to this post by Richard Durr-2
On Mon, 6 Dec 2010, Richard Durr wrote:

> You can't. You can, however, create a String representation:

Note that since Squeak 4.1 String >> #, sends #asString to it's argument,
so this will return a string: 'The answer is ', 42, $!.


Levente

>
> StringMorph contents: 'Text Stuff here:' , aSmallInteger asString.
>
> On Mon, Dec 6, 2010 at 9:31 PM, awood969 <[hidden email]> wrote:
>
>>
>> Hi guys,
>>
>> I am wondering how you can pull different datatypes into a string, for
>> example im trying to do the following with a StringMorph;
>>
>> StringMorph contents: 'Text Stuff Here: ' + SmallInteger asString
>>
>> Hard to explain myself but in PHP it would be;
>>
>> $finalvalue = "Player: " + $myint;
>>
>> and in C would be
>>
>> cout << "Player: " << myint << endl;
>>
>> Thanks!
>> Andrew
>> --
>> View this message in context:
>> http://forum.world.st/Stringing-a-string-together-tp3075262p3075262.html
>> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners