|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Right function> What happened with right function ?? May need to be fully qualified:> > What is it's substitute??? Microsoft.VisualBasic.Right Private Function GetRight(ByVal InitialString As String, ByVal
NumOfChars As Integer) As String If InitialString.Length >= NumOfChars Then Return InitialString.Substring(InitialString.Length - NumOfChars, NumOfChars) Else Return InitialString End If End Function Aristotelis Show quoteHide quote Ï "Domac" <d*@dd.cc> Ýãñáøå óôï ìÞíõìá news:ubXvi1NnGHA.2364@TK2MSFTNGP02.phx.gbl... > > What happened with right function ?? > > What is it's substitute??? > "Domac" <d*@dd.cc> schrieb: It's still there, as in VB6.> What happened with right function ?? > What is it's substitute??? 'Microsoft.VisualBasic.Strings.Right' = 'Right' :-).-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> It's still there, as previous posters pointed out. It's just a wrapper
around the methods in the String class, though. This is how it's implemented: Public Shared Function Right(ByVal str As String, ByVal Length As Integer) As String If (Length < 0) Then Throw New ArgumentException(Utils.GetResourceString("Argument_GEZero1", New String() { "Length" })) End If If ((Length = 0) OrElse (str Is Nothing)) Then Return "" End If Dim num1 As Integer = str.Length If (Length >= num1) Then Return str End If Return str.Substring((num1 - Length), Length) End Function If you know that the values you use are sane, you only need the code from the last line. If you only want to check the contents of the end of the string, there are neater methods in the string class. If Right(str, 4) = ".jpg" Then translates into: If str.EndsWith(".jpg") Then Domac wrote: Show quoteHide quote > What happened with right function ?? > > What is it's substitute??? > > > It's still there, as previous posters pointed out. It's just a wrapper Goran are you sure of that?> around the methods in the String class, though. > Because AFAIK is there more times written that this is sometimes the situation for Visual Basic functions, however not forever. Cor "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: According to the formatting style the code posted by Goran has been >> It's still there, as previous posters pointed out. It's just a wrapper >> around the methods in the String class, though. > > Goran are you sure of that? > > Because AFAIK is there more times written that this is sometimes the > situation for Visual Basic functions, however not forever. extracted using Reflector or a similar tool. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Cor Ligthert [MVP] wrote:
>> It's still there, as previous posters pointed out. It's just a wrapper If I correctly interpret what you are trying to say, you are saying that >> around the methods in the String class, though. >> > > Goran are you sure of that? > > Because AFAIK is there more times written that this is sometimes the > situation for Visual Basic functions, however not forever. > > Cor > several times it has been written that some of the Visual Basic functions are wrappers, but not all of them? Just as Herfried suspected, I have used Lutz Roeder's .NET Reflector to look at the code in the Microsoft.VisualBasic library. The code that I posted is how the actual Right method is implemented. Goran,
Than I won't call this "It's just a wrapper", for me this is a wrapper plus something extra. Cor Show quoteHide quote "Göran Andersson" <gu***@guffa.com> schreef in bericht news:eftTPDgnGHA.3784@TK2MSFTNGP04.phx.gbl... > Cor Ligthert [MVP] wrote: >>> It's still there, as previous posters pointed out. It's just a wrapper >>> around the methods in the String class, though. >>> >> >> Goran are you sure of that? >> >> Because AFAIK is there more times written that this is sometimes the >> situation for Visual Basic functions, however not forever. >> >> Cor >> > > If I correctly interpret what you are trying to say, you are saying that > several times it has been written that some of the Visual Basic functions > are wrappers, but not all of them? > > Just as Herfried suspected, I have used Lutz Roeder's .NET Reflector to > look at the code in the Microsoft.VisualBasic library. The code that I > posted is how the actual Right method is implemented. Yes, you are right, there is a bit of logic there also.
Perhaps "Not much more than a wrapper" would have been a more suitable description. Cor Ligthert [MVP] wrote: Show quoteHide quote > Goran, > > Than I won't call this "It's just a wrapper", for me this is a wrapper plus > something extra. > > Cor > > "Göran Andersson" <gu***@guffa.com> schreef in bericht > news:eftTPDgnGHA.3784@TK2MSFTNGP04.phx.gbl... >> Cor Ligthert [MVP] wrote: >>>> It's still there, as previous posters pointed out. It's just a wrapper >>>> around the methods in the String class, though. >>>> >>> Goran are you sure of that? >>> >>> Because AFAIK is there more times written that this is sometimes the >>> situation for Visual Basic functions, however not forever. >>> >>> Cor >>> >> If I correctly interpret what you are trying to say, you are saying that >> several times it has been written that some of the Visual Basic functions >> are wrappers, but not all of them? >> >> Just as Herfried suspected, I have used Lutz Roeder's .NET Reflector to >> look at the code in the Microsoft.VisualBasic library. The code that I >> posted is how the actual Right method is implemented. > >
Close all forms but Main
converting string to image..?? A question about generics How to find equal images? ClickOnce amortization... kinda how to create shift-F2 function for Textbox - shortcutkey? converting RTF backcolor to Web back color Loading Crystal report VB.NET 2.0 & Application Settings.. |
|||||||||||||||||||||||