Just starting out? Need help? Post your questions and find answers here.
Randy Walker
Addict
Posts: 1109 Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA
Post
by Randy Walker » Fri Apr 25, 2025 7:24 am
Normally i think it would be me but I can't see anything wrong here:
Code: Select all
ip$ = " ssh2 192.28.26.189"
s$ = ReplaceString(ip$,"ssh2 ","zebras")
Debug s$
Where are the zebras?
This is what I was actualy trying to do, to just remove ssh2:
Code: Select all
ip$ = " ssh2 192.28.26.189"
s$ = ReplaceString(ip$,"ssh2 ","")
Debug s$
Fails here in PB 5.40 and PB 6.20
Last edited by
Randy Walker on Fri Apr 25, 2025 6:58 pm, edited 1 time in total.
- - - - - - - - - - - - - - - -
Randy
I *never * claimed to be a programmer.
Piero
Addict
Posts: 1040 Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy
Post
by Piero » Fri Apr 25, 2025 7:42 am
normeus
Enthusiast
Posts: 475 Joined: Fri Apr 20, 2012 8:09 pm
Contact:
Post
by normeus » Fri Apr 25, 2025 8:03 am
It works with pbx64 and Win11. Could it be the space you have at the end of the search string "ssh2 "
maybe there is no space in the string to be searched
Code: Select all
ip$ = " ssh2 192.28.26.189"
s$ = Trim(ReplaceString(ip$,"ssh2",""))
Debug s$
try no spaces then Trim
norm
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Marc56us
Addict
Posts: 1600 Joined: Sat Feb 08, 2014 3:26 pm
Post
by Marc56us » Fri Apr 25, 2025 8:25 am
Randy Walker wrote: Fri Apr 25, 2025 7:24 am
Normally i think it would be me but I can't see anything wrong here:
Code: Select all
ip$ = " ssh2 192.28.26.189"
s$ = ReplaceString(ip$,"ssh2 ","zebras")
Debug s$
Where are the zebras?
This is what I was actualy trying to do, to just remove ssh2:
Code: Select all
ip$ = " ssh2 192.28.26.189"
s$ = ReplaceString(ip$,"ssh2 ","")
Debug s$
Fails here in PB 5.40 and PB 6.20
Both works PB 5.46 and PB 6.21 B6
PS. Why not use RemoveString() ?
Code: Select all
t$ = RemoveString(ip$, "ssh2 ")
Debug t$
NicTheQuick
Addict
Posts: 1527 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Fri Apr 25, 2025 8:29 am
It definitely works fine here.
My assumption is that there might be not a real space in the string but after copying it into the forum it got fixed automatically.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
BarryG
Addict
Posts: 4219 Joined: Thu Apr 18, 2019 8:17 am
Post
by BarryG » Fri Apr 25, 2025 9:27 am
Randy Walker wrote: Fri Apr 25, 2025 7:24 am Fails here in PB 5.40 and PB 6.20
Works here in 6.20.
infratec
Always Here
Posts: 7662 Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany
Post
by infratec » Fri Apr 25, 2025 9:35 am
use this
Code: Select all
ip$ = " ssh2 192.28.26.189"
ShowMemoryViewer(@ip$, StringByteLength(ip$))
And check if there is a 20 00 after the 2 (32 00)
Randy Walker
Addict
Posts: 1109 Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA
Post
by Randy Walker » Fri Apr 25, 2025 6:56 pm
Marc56us wrote: Fri Apr 25, 2025 8:25 am
Both works PB 5.46 and PB 6.21 B6
PS. Why not use RemoveString() ?
Code: Select all
t$ = RemoveString(ip$, "ssh2 ")
Debug t$
Damned computers.
Tried again this morning in PB 5.40 and PB 6.20 -- both worked fine.
Thanks for the removestring tip. I didn't know it was even there and it works great too.
- - - - - - - - - - - - - - - -
Randy
I *never * claimed to be a programmer.