Trim string with vb.net

1

could someone tell me how to cut out a string of characters by getting the number X of characters and adding ... to the end of the string in ASP.net

Dim cadenaOriginal As String = "Anita lava la tina."
Dim cadenaRecortada As String = "Anita lava..."

In that case, the first 10 characters of the string are subtracted (counting the space)

    
asked by Abraham Montes 23.05.2018 в 16:44
source

2 answers

1

Whereas:

  

In that case, the first 10 characters of the string are subtracted

I have the following code:

Imports System

Public Module Module1
    Public Sub Main()

        Dim cadenaOriginal As String = "Anita lava la tina."
        Dim cadenaNueva As String = cadenaOriginal.Substring(0,10) + "..."
        Console.WriteLine(cadenaNueva)

    End Sub
End Module

This results in:

Anita lava...
    
answered by 06.06.2018 в 03:32
-1
' Pon esto al principio del archivo fuera del Modulo
imports vb = Microsoft.VisualBasic

' Dentro de las funciones que has incorporado tienes las Funciones 
 Dim Cadena1 = vb.Left(Cadena,NumCaracteres) as String
 Dim Cadena2 = vb.Right(Cadena,NumCaracteres) as String

'The Language is Visual Basic.NET 'The Imports vb = Microsoft.VisualBasic is Put Out of Classes 'And the functions below return a Variable They are like this and have to go in the' Sub and Functions of Your Program in VB.NET

Dim Original string As String = vb.Left ("This is the Example", 4) MsgBox (Original string)

I hope it serves you ...

    
answered by 29.05.2018 в 15:32