// Five: Go strings 패키지를 PRG에서 자유롭게 사용 IMPORT "strings" PROCEDURE Main() LOCAL cText, aParts, cUpper, cResult LOCAL lFound, nCount, nPos, i LOCAL cJoined, cTrimmed, cReplaced cText := "Hello,World,Five,Go,Harbour" // Split → Harbour 배열로 자동 변환 aParts := strings.Split(cText, ",") ? "Split 결과:", Len(aParts), "개" FOR i := 1 TO Len(aParts) ? " [" + Str(i, 1) + "]", aParts[i] NEXT ? // Store results in separate variables cUpper := strings.ToUpper(cText) lFound := strings.Contains(cText, "Five") nCount := strings.Count(cText, ",") nPos := strings.Index(cText, "Go") ? "원본: ", cText ? "ToUpper: ", cUpper ? "Contains 'Five':", lFound ? "쉼표 갯수:", nCount ? "'Go' 위치:", nPos ? // 조합해서 사용 cJoined := strings.Join(aParts, " | ") cTrimmed := strings.TrimSpace(" hello ") cReplaced := strings.ReplaceAll(cText, ",", " → ") ? "Join: ", cJoined ? "Trim: [" + cTrimmed + "]" ? "Replace: ", cReplaced ? // 조건 분기에서 활용 IF strings.HasPrefix(cText, "Hello") ? "Hello로 시작합니다" ENDIF IF strings.HasSuffix(cText, "Harbour") ? "Harbour로 끝납니다" ENDIF // 루프에서 활용 ? "대문자로 시작하는 단어:" FOR i := 1 TO Len(aParts) IF strings.ToUpper(Left(aParts[i], 1)) == Left(aParts[i], 1) ? " ", aParts[i] ENDIF NEXT RETURN