Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / text lenght to text width converter?

Author
Message
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2010 17:13
Looking for something that will keep text length and text width the same.

What you say!

ok I have stars$="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" adds up to 44 X'es.

how ever if I make it NINE NINE in words it takes 9 X'es off, but because I's are half spaced it end up begin short, I need to add more X'es or stop it taking them off.

looks like this
NINE NINE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |Dollars
would like this
NINE NINE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|Dollars
the word Dollars is fixed on an image.

using this


so would like away to do

tl=len(text width(moneystring$))

hope someone can see what I am asking help for.

Dark Physics makes any hot drink go cold.
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2010 17:42
working demo of the problem.



Dark Physics makes any hot drink go cold.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Jul 2010 18:16
You could pad out the text with...

while text width(t$)>200
t$=right$(t$,len(t$)-1)
endwhile

To bring it down to around 200 wide, or...

while text width(t$)<200
t$="X"+t$
endwhile

You could do both to cover all the bases, but I'm wondering why you don't just right justify the text, just decrease the X location by the text width and you have right justification.

Health, Ammo, and bacon and eggs!
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2010 18:46
cheers Van B that what I was looking, works great.

Dark Physics makes any hot drink go cold.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Jul 2010 18:46 Edited at: 29th Jul 2010 20:42
nvm

So many games to code.......so little time.

Login to post a reply

Server time is: 2026-07-25 17:47:58
Your offset time is: 2026-07-25 17:47:58