.


:




:

































 

 

 

 


4.9.5-3. -Function, .




. 4.9.5-3.

 

Function Pr953(ByVal row As String, ByVal simvol As Char) As String Dim x As String, i As Byte x = CStr(Len(row)) For i = 1 To CByte(x) If Mid(row, i, 1) = simvol Then row = row.Substring(1, i - 1)+row.Substring(i + 1, CInt(x)) End If Next Return row End Function Private Sub Button1_Click() Dim s As Char, r As String r = TextBox1.Text: s = CChar(InputBox(" ")) Label2.Text = " : " & Pr953(r, s) End Sub

. 4.9.5-3. Pr953() 4.9.5-3

Pr953() Substring(), . ( )
row = row.Substring(1, i - 1) + row.Substring(i + 1, CInt(x))

, , a M, MA. . , , .

4.9.5-4. -Function, , Simvol_1 Simvol_2. , , .

Pr954() row
simvol_1 simvol_2. Pr954()
Substring(), tmp. , , . . 4.9.5-4.

 

Function Pr954(ByVal row As String, ByVal simvol_1 As Char, _ ByVal simvol_2 As Char) As Integer Dim i, kol As Integer Dim x, tmp As String x = CStr(Len(row)) For i = 1 To CInt(x) tmp = row.Substring(i, 1) If tmp = simvol_1 Or tmp = simvol_2 Then kol = kol + 1 Next Return kol End Function Private Sub Button1_Click() Dim r As String Dim s_1, s_2 As Char r = TextBox1.Text s_1 = CChar(InputBox(" ")) s_2 = CChar(InputBox(" ")) Label2.Text = " " & s_1 & "" & s_2 & " = " _ & Pr954(r, s_1, s_2) End Sub

. 4.9.4-4. Pr954( )

4.9.5-4

4.9.5-5. -Function, , Row_1 .

Pr955() IndexOf(), Row_1 Row, .
Exit Do.

. 4.9.5-5.

Function Pr955(ByVal row As String, ByVal row_1 As String) _ As Integer Dim i, kol As Integer Dim x As String i = 1 Do x = CStr(row.IndexOf(row_1, i)) If CDbl(x) > 0 Then i = CInt(CDbl(x) + Len(row_1)) kol = kol + 1 Else Exit Do End If Loop Pr945 = kol End Function Private Sub Button1_Click() Dim r, r_1 As String r = TextBox1.Text r_1 = InputBox(" ") Label2.Text = " " & _ r_1 & " " & Pr955(r, r_1) End Sub

 

. 4.9.5-5. Pr952()

4.9.5-5


4.9.5-6. -Function, , , . , .

, , , .

Sub Pr956(ByRef s As String) s = s.Trim ' Do While s.IndexOf(Space(2)) >= 0 s = s.Replace(Space(2), Space(1)) Loop End Sub Function Reshenie(ByVal s As String) As String Dim Rez As String = "" Dim i, j, d, k As Integer Dim slovo As String Dim mas() As String = s.Split(CChar(Space(1))) ' For i = 0 To mas.Length - 1 slovo = mas(i) k = 0 ' d = slovo.Length ' For j = 0 To d - 1 ' If slovo.Substring(j, 1) >= "0" And _ slovo.Substring(j, 1) <= "9" Then k = k + 1 End If Next If k = d Then Rez = Rez + slovo + Space(1) End If Next If Rez = "" Then Rez = " " End If Return Rez End Function . 4.9.5-6. Pr956() Reshenie() 4.9.4-6

- Reshenie(). Pr956() mas() Split(), .

Substring() - . , , , , Rez. Rez (.. ), " ".

 

 


 

1. ()

1) , ,

2)

3)

4) , ,

2.

1) $

2) b

3) c1

4)

3.

1) Len()

2) Left()

3) Asc()

4) Mid ()

4. ,

1) >, <, =, < =, > =, <>, +, &

2) +, =, &

3) =

4)

5. a.Substring(0, n)

1) n a

2) n a

3)

4) , n a

5)

6. a.Substring(n, m)

1) a, n-, m

2) a, m-, n c,

3)

4)

7. Space(n)

1) n

2) n

3) n

4) n


8. a.ToUpper

1) a

2)

3)

4)

9. a.ToLower

1) a

2)

3) a

4) a

10. a.TrimStart

1) a

2) a

3) a

4)

5)

11. a.TrimEnd

1)

2)

3)

4)

5)

12. a.Indexof(b, n)

1) n- a, b

2) n- b, a

3) n a n b

13. Chr(n)

1) , ASCII n

2) n

3) n

4) n

14. Asc(a)

1) ASCII a

2) a

3) a

4)

15. Val(a)

1) a ,

2)

3) ASCII

4)

16.

Dim a As String = "" TextBox1.Text = a.Substring(0, 6)

1)

2) O

3)

4)

17.

A ="" a.Replace("","") TextBox1.Text= a

1)

2)

3)

18. Ucase (a)

1) c

2)

3)

4)

19. Ltrim (A)

1) A

2)

3)

4)

5)

20. Rtrim (a)

1)

2)

3)

4)


21.

4.9.7.

 

: , , , , .

 

,

 

1) .

2) .

3) .NET Framework .

4) .

5) .

6) .

 

 

1) ( 9).

2) . 4.9.7-1.

3) .

4) , .

5) .

6) , , . . , .

7) .

8) .

 


 

4.9.7-1

1) , .
2) , , : , (, "" ""), , .
3) , , , , .
4) , , , .
5) , .
6) , , .
7) , .
8) , .
9) , , . , .
10) , , , , .
11) , , , , .
12) , , , .
13) , , , .
14) "mm-dd-yyyy", mm , dd , yyyy . "dd.mm.yy", yy .
15) , , "" , "XXXXX" "nX", X , n .
16) , , , .
17) , .
18) .
19) , , (a, e, i, o, u, y).
20) , , , , : .
21) , , , .
22) , , , , .. .
23) , .
24) , "dd.mm.yy", dd , mm , yy , , n , .
25) , .
26) , .
27) n- . n- -1.
28) "" 10 , . , , 10*(k - 1) + 1, k "".
  , , , ʻ .
30) , "dd.mm.yy", dd , mm , yy , , n , .

 

4.9.7.4.

 

1) .

2) , , , .

3) .

4) .

5) .

5.1) ;

5.2) ;

5.3) ;

5.4) .

6) .

7) .

 

 

1) :

:

.

2) , , , :

., 1405, 13.

3) :

, a b, , , a , b b. .

4) :

5) , :

5.1) :

, . 4.9.7-1.

 

 

. 4.9.7-1. 9

 

5.2) :

, . 4.9.7-2.

 

4.9.7-2

Form1 Name Form1
Text   4.9:
Label1 Text   : , , b .
ImageAlign MiddleCenter
Label2 Text   a
ImageAlign MiddleCenter
Label3 Text b
Label4 Text
TextBox1 Name TextBox1
TextBox2 Name TextBox2
TextBox3 Name TextBox3
Button1 Name Button1
Text
Button2 Name Button2
Text

 

5.3) :

()
. 4.9.7-2.

 

 

. 4.9.7-2. () 9

5.4) :

. 4.9.7-3

 

Public Class Form1 ' TextB ox Function vvod(ByVal T As TextBox) As String Return T.Text End Function ' TextBox Sub vivod(ByVal z As String, ByRef t As TextBox) If z.Length <> 0 Then t.Text = z Else t.Text = " " End If End Sub ' Sub (ByVal b As String, ByRef a As String) Dim d, m, i, j As Short m = CShort(a.Length) ' a d = CShort(b.Length) ' b For i = 0 To CShort(d - 1) Step 2 ' b j = 0 Do While j < m ' a If a.Substring(j, 1) = b.Substring(i, 1) Then a = a.Remove(j, 1) ' a m = CShort(m - 1)' a Else j = CShort(j + 1) ' a End If Loop Next i End Sub Private Sub Button1_Click(sender As Object, _ e As EventArgs) Handles Button1.Click Dim Str1, Str2 As String Str1 = vvod(TextBox1): Str2 = vvod(TextBox2) (Str2, Str1) vivod(Str1, TextBox3) End Sub Private Sub Button2_Click(sender As Object, _ e As EventArgs) Handles Button2.Click End End Sub End Class

. 4.9.7-3. 9

 

6) :

. 4.9.7-4.

. 4.9.7-4. 9

 

7) :

a="aabbssvvffgghh". b="absh" "a" "s". : "bbvvffgghh".

, .

 

1) ?

2) Sysem.String?

3) ?

4) ?

5) " ". ? ?

6) ?

7) ?

8) ?

9) ?

10) ?

11) ?

12) ?

13) , , , ?

14) , ?

15) ?

16) ?

17) ?

18) ?

19) ?

20) ?

21) Trim()?

22) Split()?

23) Join()?

24) StringBuilder, , ?

25) .NET Framework ?

26) ?

27) Char.

28) String.

29) .

30) String.

 





:


: 2016-11-24; !; : 531 |


:

:

- , 20 40 . - .
==> ...

1599 - | 1558 -


© 2015-2024 lektsii.org - -

: 0.111 .