- 2025-07-28 1.0.10 Nueva función DescomponerCNsuscriptor

This commit is contained in:
2025-07-29 07:58:57 +02:00
parent 56975dd840
commit 5422b6b686
2 changed files with 71 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text
Imports System.Text.RegularExpressions
Public Class crypt
Public Shared Function FEncS$(ByVal X$, ByVal Jco0$, ByVal Jcd0$, ByVal Xs0 As Long)
@@ -560,4 +561,71 @@ Public Class crypt
Return Encoding.UTF8.GetString(ms.ToArray())
End Function
Public Shared Function DescomponerCNsuscriptor(CNsuscriptor As String,
Optional ByRef nombre As String = Nothing,
Optional ByRef docIdentidad As String = Nothing,
Optional ByRef numPersonal As String = Nothing) As Boolean
nombre = CNsuscriptor
docIdentidad = Nothing
numPersonal = Nothing
If String.Compare(CNsuscriptor, "", False) = 0 Then
Return False
End If
Dim text As String = Nothing
Dim text2 As String = Nothing
Dim array() As String = Regex.Split(CNsuscriptor, " DI=")
If array.Length > 2 Then
Return False
End If
Dim text3 As String
If array.Length = 2 Then
text3 = array(0)
array = Regex.Split(array(1), " N=")
If array.Length > 2 Then
Return False
End If
text = array(0)
If array.Length = 2 Then
text2 = array(1)
End If
Else
array = Regex.Split(CNsuscriptor, " N=")
If array.Length > 2 Then
Return False
End If
text3 = array(0)
If array.Length = 2 Then
text2 = array(1)
End If
End If
If String.IsNullOrWhiteSpace(text3) OrElse text3.Contains("=") Then
Return False
End If
If text IsNot Nothing AndAlso (String.IsNullOrWhiteSpace(text.Trim()) OrElse text.Contains("=")) Then
Return False
End If
If text2 IsNot Nothing AndAlso (String.IsNullOrWhiteSpace(text2.Trim()) OrElse text2.Contains("=")) Then
Return False
End If
nombre = text3
docIdentidad = text
numPersonal = text2
Return True
End Function
End Class