1
0
mirror of https://github.com/ManyakRus/starter.git synced 2025-11-28 23:20:10 +02:00

сделал FindPos()

This commit is contained in:
Sanek
2025-07-07 09:13:52 +03:00
parent f3b8f6f37e
commit 1772a7bf52
2 changed files with 28 additions and 0 deletions

View File

@@ -2056,3 +2056,23 @@ func Path_Linux_to_Windows(s string) string {
return Otvet
}
// FindPos - находит наименьший индекс вхождения подстроки
func FindPos(Text string, MassFind ...string) int {
Otvet := -1
PosMin := math.MaxInt
for _, s1 := range MassFind {
pos1 := strings.Index(Text, s1)
if pos1 < PosMin {
PosMin = pos1
}
}
if PosMin != math.MaxInt {
Otvet = PosMin
}
return Otvet
}