Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Wishlist

23 views
Skip to first unread message

H P

unread,
Feb 20, 2025, 1:52:43 PMFeb 20
to sem...@googlegroups.com
Sammy,

I would like to propose to the wishlist a function something like ChrTimes() or TimesChr() with 2 parameters being an integer and a chr.
I should work like TimesChr(8, "*") which should create a string of 8 * so ********. 


Met vriendelijke groet,
With kind regards,
Muy atentamente,
Mit Freundliche Gruß,
Sinceramente,


H. Pikaar

Henri...@gmail.com

Carlo Hogeveen

unread,
Feb 20, 2025, 1:59:16 PMFeb 20
to sem...@googlegroups.com

 

There is such a function:

   Format('':8:'*')

 

See the syntax of Format() in TSE’s Help or in the Help’s web copy:

   https://ecarlo.nl/tse/files/TseHelp.html#format

 

Carlo

 

 

 

J. David Boyd

unread,
Feb 20, 2025, 2:14:59 PMFeb 20
to sem...@googlegroups.com
I thought we had something like that already....

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/CAAR3jqHkLgDJo1Oo-UYCY8nv_VddpyJ6jBnV%2BZToKFkf2sN5oA%40mail.gmail.com.


--
What's so funny about peace, love, and understanding? 

knud van eeden

unread,
Feb 20, 2025, 4:24:15 PMFeb 20
to sem...@googlegroups.com
--- cut here: begin --------------------------------------------------

 PROC Main()
  STRING s[255] = Format( "" : 8 : "*" ) // same as BASIC STRING$( 8, "*" )
  Warn( s )
  CopyToWinClip( s )
 END

--- cut here: end ----------------------------------------------------

gives

 ********

===

--- cut here: begin --------------------------------------------------

 PROC Main()
  STRING s[255] = Format( "" : 8 : "hello" ) // not the same as BASIC STRING$( 8, "hello" )
  Warn( s )
  CopyToWinClip( s )
 END

--- cut here: end ----------------------------------------------------

gives

 hhhhhhhh

=> it only works for repetition of a single character.

with friendly greetings
Knud van Eeden

knud van eeden

unread,
Feb 20, 2025, 4:29:40 PMFeb 20
to sem...@googlegroups.com
FORWARD PROC Main()
FORWARD STRING PROC FNStringGetInStringS( INTEGER i1, STRING s1 )


// --- MAIN --- //

PROC Main()
 STRING s1[255] = "3" // change this
 STRING s2[255] = "a" // change this
 IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: totalT = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
 IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: string = ", s2, _EDIT_HISTORY_ ) ) AND ( Length( s2 ) > 0 ) ) RETURN() ENDIF
 Warn( FNStringGetInStringS( Val( s1 ), s2 ) ) // gives "aaa"
 Warn( FNStringGetInStringS( 15, "0" ) ) // gives "000000000000000"
 Warn( FNStringGetInStringS( 3, " " ) ) // gives "   "
 Warn( FNStringGetInStringS( 8, "hello" ) ) // gives "hellohellohellohellohellohellohellohello"
END

<F12> Main()

// --- LIBRARY --- //

// library: string: get: in: string <description>create concatenated duplicates of a certain string (STRING$ in BBCBASIC)</description> <version>1.0.0.0.7</version> <version control></version control> (filenamemacro=getstist.s) [<Program>] [<Research>] [kn, zoe, th, 20-05-1999 11:25:55]
STRING PROC FNStringGetInStringS( INTEGER maxI, STRING inS )
 // e.g. PROC Main()
 // e.g.  STRING s1[255] = "3" // change this
 // e.g.  STRING s2[255] = "a" // change this
 // e.g.  IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: totalT = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
 // e.g.  IF ( NOT ( Ask( "string: get: copy: create concatenated duplicates of a certain string: string = ", s2, _EDIT_HISTORY_ ) ) AND ( Length( s2 ) > 0 ) ) RETURN() ENDIF
 // e.g.  Warn( FNStringGetInStringS( Val( s1 ), s2 ) ) // gives "aaa"
 // e.g.  Warn( FNStringGetInStringS( 15, "0" ) ) // gives "000000000000000"
 // e.g.  Warn( FNStringGetInStringS( 3, " " ) ) // gives "   "
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 //
 INTEGER minI = 1
 //
 INTEGER I = 0
 //
 STRING s[255] = ""
 //
 IF ( maxI <= 0 )
  //
  RETURN( "" )
  //
 ENDIF // minimum 1 character width block or more to insert
 //
 FOR I = minI TO maxI
  //
  s = Format( s, inS )
  //
 ENDFOR
 //
 RETURN( s )
 //
END



knud van eeden

unread,
Feb 20, 2025, 4:37:59 PMFeb 20
to sem...@googlegroups.com
Simplest general implementation:

STRING PROC StringRepeat( STRING inS, INTEGER I )
 STRING s[255] = ""
 DO I TIMES
  s = s + inS
 ENDDO
 RETURN( s )
END

PROC Main()
 Warn( StringRepeat( "*", 8 ) ) // gives ********
END



H P

unread,
Feb 21, 2025, 8:38:34 AMFeb 21
to sem...@googlegroups.com
Must have missed that somewhere, but thanks to all for putting me in the right direction.


Met vriendelijke groet,
With kind regards,
Muy atentamente,
Mit Freundliche Gruß,
Sinceramente,


H. Pikaar

Henri...@gmail.com



Op do 20 feb 2025 om 22:37 schreef 'knud van eeden' via SemWare TSE Pro text editor <sem...@googlegroups.com>:
Reply all
Reply to author
Forward
0 new messages