ID:169201
 
Just wondering if there is any easy way to capitalise the first letter of a text string?

Thanks in advance

- GunRunner

proc/captilize_letter(t,start,end)
if(!istext(t))return t
if(copytext(t,start,end)==uppertext(copytext(t,start,end)))return t
t="[uppertext(copytext(t,start,end))][copytext(t,end,length(t)+1)]"
return t

Something like that should work
In response to Ol' Yeller
Hey,

I really got stuck in this code could you please more specific and help me on it

http://developer.byond.com/forum/ index.cgi?action=message_read&id=371243&forum=8&view=0
In response to Ol' Yeller
Just one more thing, how would I convert a text string into a list? As in each element of list contains one of the letters of the string.

Thansk again

- GunRunner
In response to Ol' Yeller
Ol' Yeller wrote:
> proc/captilize_letter(t,start,end)
> if(!istext(t))return t
> if(copytext(t,start,end)==uppertext(copytext(t,start,end)))return t
> t="[uppertext(copytext(t,start,end))][copytext(t,end,length(t)+1)]"
> return t


proc/cap(text)
if(!istext(T)||!lentext(T))return T
.=copytext(text,1,2)+copytext(text,2)
In response to GunRunner
I know I've seen a procedure someone wrote to do this, look on the hub.
In response to Crashed
Crashed wrote:
Ol' Yeller wrote:
> > proc/captilize_letter(t,start,end)
> > if(!istext(t))return t
> > if(copytext(t,start,end)==uppertext(copytext(t,start,end)))return t
> > t="[uppertext(copytext(t,start,end))][copytext(t,end,length(t)+1)]"
> > return t

> proc/cap(text)
> if(!istext(T)||!lentext(T))return T
> .=copytext(text,1,2)+copytext(text,2)
>


You forgot to do the actual capitalizing there.
In response to GunRunner
This time I'll get it right!
text2list(t)
if(!istext(t))return
if(lentext(t)<2)return list(t)
var/list/l[0]
for(var/i=1 to lentext(t))
l+=copytext(t,i,i+1)
return l