Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
public static  int getIndexTFromString (String Nom_T)
	{
		int  i=-1;
		if  (Nom_T.contains("TCreation")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posC = Nom_T.indexOf("C") ; 
		sub =   Nom_T.substring(posT+1,posC) ;
		  return i = Integer.parseInt(sub) ; 
		} 
	 if  (Nom_T.contains("TIncremtPeriod")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posI = Nom_T.indexOf("I") ; 
		sub =   Nom_T.substring(posT+1,posI) ;
		 return  i = Integer.parseInt(sub) ; 
		} 
	 if  (Nom_T.contains("TReset")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posR = Nom_T.indexOf("R") ; 
 
 
		sub =   Nom_T.substring(posT+1,posR) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		 if  (Nom_T.contains("TActivation")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posA = Nom_T.indexOf("A") ; 
 
 
		sub =   Nom_T.substring(posT+1,posA) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		if  (Nom_T.contains("TExecution")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posE = Nom_T.indexOf("E") ; 
 
 
		sub =   Nom_T.substring(posT+1,posE) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		if  (Nom_T.contains("TIncrementing")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posI = Nom_T.indexOf("I") ; 
 
 
		sub =   Nom_T.substring(posT+1,posI) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		if  (Nom_T.contains("TReceiving")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posR = Nom_T.indexOf("R") ; 
 
 
		sub =   Nom_T.substring(posT+1,posR) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		 if  (Nom_T.contains("TReleasing")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posR = Nom_T.indexOf("R") ; 
 
 
		sub =   Nom_T.substring(posT+1,posR) ;
 
		 return  i = Integer.parseInt(sub) ; 
		} 
		 if  (Nom_T.contains("TSending")) 
		{
			String sub ="" ; 
		int posT = Nom_T.indexOf("T") ; 
		int posS = Nom_T.indexOf("S") ; 
 
 
		sub =   Nom_T.substring(posT+1,posS) ;
 
		 return  i = Integer.parseInt(sub) ; 
		}
 
		return i ;
	}

cette fontion permet de dégager un entier à partir d'un String
lorsque j'appelle dans le programme principale main System.out.print("#"+getIndexTFromString ("T11Releasing"));
ça donne toujour la valeur d'erreur -1
aidez moi s'il vous plait