1 / 1
" FillString"으로 검색하여,
2 건의 기사가 검색 되었습니다.
-
2014-05-08랜덤키를 만들어야 하는 경우에 이용가능하다.랜덤으로 만들어진 값을 숫자(0~9)와 알파벳으로 표현하는 36진수로 변환 하여 랜덤키를 만듭니다.<%response.write KeyGen32()&".txt"function KeyGen32()dim iRnd, Responsedim cRnd, iRandomizecRnd = ""for i = 1 to 8iRnd = Int(( 999999 - 1 + 1) * Rnd + 1) '=== 6 digitscRnd = cRnd & Dec6to36( FillZero(iRnd,6) )nextKeyGen32 = cRndend functionfunction Dec6to36(num)dim d1,d2,d3,d4,r1,r2d1 = Int( num / 46656 )r1 = ( num mod 46656 )d2 = Int( r1 / 1296 )r2 = ( r1 mod 1296 )d3 = Int( r2 / 36 )d4 = ( r2 mod 36 )Dec6to36 = Convert10to36(d1) & Convert10to36(d2) & Convert10to36(d3) & Convert10to36(d4)end function'== 10진수를 36진수로 변환function Convert10to36( i )if ( i < 10 ) thenConvert10to36 = ielseConvert10to36 = chr(55+i)end ifend functionfunction FillZero( cString, iLength )FillZero = FillString( cString, iLength, "0" )end functionfunction FillString( cString, iLength, cFillString )if( iLength >Len(cString) ) thenFillString = ( String( iLength -Len( cString ), cFillString ) & cString )elseFillString = cStringend ifend function%>
-
2014-04-30문자 채우기문자(숫자)를 출력하면서 특정문자를 결합하는 경우에 사용한다 - 숫자 "1"을 네자리의 Numneric(빈자리가 "0"로 채워진) 4자리로 변환 하는 경우 1 => "0001" - 좌우측으로 여백문자처리의 경우 • FillString(): 특정문자 채우기 • FillZero(): "0" 문자 채우기 • FillSpace(): 스페이스 채우기문자 자르기mid() 함수를 이용하여 문자를 자르는 경우 2byte 문자도 자릿수에 상관 없이 1문자로 처리되기 떄문에 의도한 것보다 길게 나오는 경우가 많은데 2byte 문자를 감안하여 해당 자릿수에서 문자를 잘라 반환 한다 - 게시판의 제목 등 길어질 수 있는 내용을 좁은 구역에 출력시 유효 - 지정길이보다 긴 경우 +More 사용 • HLeftB(): 2byte 문자 자르기 • HLeftBMore(): 2byte 문자 자른 후 길이가 넘는 경우 "…" 문자 추가<%'===============================================' >> Fill Stuff functions'' FillZero( cString, iLength )' FillSpace( cString, iLength )' FillString( cString, iLength, cFillString )''===============================================function FillZero( cString, iLength )FillZero = FillString( cString, iLength, "0" )end functionfunction FillSpace( cString, iLength )FillSpace = FillString( cString, iLength, " " )end functionfunction FillSpaceRight( cString, iLength )FillSpaceRight = FillStringRight( cString, iLength, " " )end functionfunction FillString( cString, iLength, cFillString )if( iLength >Len(cString) ) thenFillString = ( String( iLength -Len( cString ), cFillString ) & cString )elseFillString = cStringend ifend functionfunction FillStringRight( cString, iLength, cFillString )if( iLength >Len(cString) ) thenFillStringRight = ( cString & String( iLength -Len( cString ), cFillString ) )elseFillStringRight = cStringend ifend functionfunction HLeftB( cString, iLen ) dim i, c, a, bdim cReturnb = 0cReturn = ""if not IsNull(cString) thenfor i = 1 to Len(cString)c = mid(cString,i,1)a = asc(c)cReturn = cReturn&cif (a>255 or a<0) thenb = b+2elseb = b+1end ifif (iLen=<b) thenexit forend ifnextend ifHLeftB = cReturnend functionfunction HLeftBMore( cString, iLen ) dim cc = HLeftB( cString, iLen ) if (cString>c) thenc = c &"…"end ifHLeftBMore = cend function%>
1
