Thread View: pl.comp.lang.vbasic
4 messages
4 total messages
Started by Jagar
Sun, 24 Jan 2010 19:27
VB 2008 odpowidnik String$ z VB6
Author: Jagar
Date: Sun, 24 Jan 2010 19:27
Date: Sun, 24 Jan 2010 19:27
9 lines
1113 bytes
1113 bytes
Witam, Jest może w VB 2008 odpowiednik funkcji String$ z VB6 powtarzającej zadany tekst żądaną liczbę razy? w VB6 wyglądało to tak: String$(zadany tekst, liczba powtórzeń) szukam czegoś podobnego w VB2008 / VB2010.. Pozdrawiam Arek
Re: VB 2008 odpowidnik String$ z VB6
Author: joker77
Date: Sun, 24 Jan 2010 19:54
Date: Sun, 24 Jan 2010 19:54
9 lines
1411 bytes
1411 bytes
function tekst(ciag as string, powtorz as integer)as string var c1 as string="" for i as integer=1 to powtorz c1+=ciag next return c1 end function Chyba prościej się nie da?
Re: VB 2008 odpowidnik String$ z VB6
Author: ktos
Date: Sun, 24 Jan 2010 22:39
Date: Sun, 24 Jan 2010 22:39
17 lines
1454 bytes
1454 bytes
joker77 pisze:
> function tekst(ciag as string, powtorz as integer)as string
> var c1 as string=""
> for i as integer=1 to powtorz
> c1+=ciag
> next
> return c1
> end function
>
> Chyba prościej się nie da?
Czy prosciej nie wiem, ale krocej :) i pewnie szybciej
Function Repeat(ByVal instr As String, ByVal n As Integer) As String
Dim result = New StringBuilder(instr.Length * n)
Return result.Insert(0, instr, n).ToString()
End Function
Re: VB 2008 odpowidnik String$ z VB6
Author: Arek
Date: Mon, 25 Jan 2010 00:52
Date: Mon, 25 Jan 2010 00:52
26 lines
1766 bytes
1766 bytes
"ktos" <ktos@nikt.pl> wrote in message news:hjii2u$ki4$1@node1.news.atman.pl... > joker77 pisze: >> function tekst(ciag as string, powtorz as integer)as string >> var c1 as string="" >> for i as integer=1 to powtorz >> c1+=ciag >> next >> return c1 >> end function >> >> Chyba prościej się nie da? > > Czy prosciej nie wiem, ale krocej :) i pewnie szybciej > > Function Repeat(ByVal instr As String, ByVal n As Integer) As String > Dim result = New StringBuilder(instr.Length * n) > Return result.Insert(0, instr, n).ToString() > End Function > miałem na myśli czy może w VB 2008 jest wbudowana funkcja podobna do String$ z VB6 żebym nie musiał swojej funkcji pisać.. :-) ale wielkie dzięki za odpowiedzi
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads