블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
Ant (2)
Maven (29)
iBATIS (7)
Regular Expression (6)
Java Web Start (4)
WebServices (14)
JAXB (12)
CAS (13)
JBoss Seam (6)
OSGi (1)
Hibernate (2)
James (6)
Alfresco (17)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
04-28 10:54
 

달력

« » 2024.4
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
 

최근에 올라온 글

최근에 달린 댓글



문자열의 내용을 바꿀 때 "String.replaceAll()" 메소드를 주로 사용하게 될 것입니다.

하지만 첫번째 파라미터가 정규표현식이기 때문에 교체할 문자열에 특수문자가 들어간다면 원하는 결과를 얻지 못하게 될 것입니다.

위의 문제를 해결할 방법을 고민하다가 아래 메소드를 만들어보았습니다.



교체할 문자열 자체를 정규표현식에서 인식할 수 있도록 한번 변경해준 다음에 처리를 하는 메소드입니다.

아직까지는 문제없이 잘 돌아갑니다. ㅎㅎ

문제가 생겼습니다. replacement 에 특수문자가 들어가면 원하는 결과를 얻을 수 없습니다.

다음과 같이 수정하면 원하는 결과를 얻을 수 있습니다. ㅎㅎㅎ





Posted by 자수씨
, |

















아래와 같은 코드가 있습니다.


이 코드를 작성한 작자는 datas 가 8 개의 요소를 가지고 있는 배열이기를 원합니다.



오묘해... 오묘해...

Posted by 자수씨
, |

HTML 의 style 속성을 가지고 이리저리 만져볼 일이 생겨서 StyleSheet 라는 클래스를 만들어 보았습니다.


정규식을 이용하여 style 속성을 분리하여 Map 에 담아서 슥삭슥삭 합니다.


[테스트 코드]

[출력 결과]
style-name: 바탕글; margin-left: 0.0pt; margin-right: 0.0pt; margin-top: 0.0pt; margin-bottom: 0.0pt; text-align: justify; text-indent: 0.0pt; line-height: 160%; font-size: 10.0pt; font-family: 굴림; letter-spacing: -1.5pt; font-weight: normal; font-style: normal; color: #000000; 
 


쓰면서 슬슬 고쳐나가야 할 듯 합니다.

Posted by 자수씨
, |

아래와 같은 문서가 있습니다.
P.HStyle0, LI.HStyle0, DIV.HStyle0
 {style-name:"바탕글"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle1, LI.HStyle1, DIV.HStyle1
 {style-name:"본문"; margin-left:15.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle2, LI.HStyle2, DIV.HStyle2
 {style-name:"개요 1"; margin-left:10.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle3, LI.HStyle3, DIV.HStyle3
 {style-name:"개요 2"; margin-left:20.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle4, LI.HStyle4, DIV.HStyle4
 {style-name:"개요 3"; margin-left:30.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle5, LI.HStyle5, DIV.HStyle5
 {style-name:"개요 4"; margin-left:40.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle6, LI.HStyle6, DIV.HStyle6
 {style-name:"개요 5"; margin-left:50.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle7, LI.HStyle7, DIV.HStyle7
 {style-name:"개요 6"; margin-left:60.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle8, LI.HStyle8, DIV.HStyle8
 {style-name:"개요 7"; margin-left:70.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle9, LI.HStyle9, DIV.HStyle9
 {style-name:"쪽 번호"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:굴림; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle10, LI.HStyle10, DIV.HStyle10
 {style-name:"머리말"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:150%; font-size:9.0pt; font-family:굴림; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle11, LI.HStyle11, DIV.HStyle11
 {style-name:"각주"; margin-left:13.1pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:-13.1pt; line-height:130%; font-size:9.0pt; font-family:바탕; letter-spacing:0.5pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle12, LI.HStyle12, DIV.HStyle12
 {style-name:"미주"; margin-left:13.1pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:-13.1pt; line-height:130%; font-size:9.0pt; font-family:바탕; letter-spacing:0.5pt; font-weight:"normal"; font-style:"normal"; color:#000000;}
P.HStyle13, LI.HStyle13, DIV.HStyle13
 {style-name:"메모"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:9.0pt; font-family:굴림; letter-spacing:0.5pt; font-weight:"normal"; font-style:"normal"; color:#000000;}

여기에서 P 스타일의 이름과 속성들을 개별적으로 뽑으려면 어떻게 할까요?

P.HStyle0, LI.HStyle0, DIV.HStyle0
 {style-name:"바탕글"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:"normal"; color:#000000;}

예를 들면, 위의 내용으로 아래의 데이터를 뽑아내는 것 입니다.

{ styleName: "HStyle0", style: "style-name:\"바탕글\"; margin-left:0.0pt; margin-right:0.0pt; margin-top:0.0pt; margin-bottom:0.0pt; text-align:justify; text-indent:0.0pt; line-height:160%; font-size:10.0pt; font-family:바탕; letter-spacing:0.0pt; font-weight:"normal"; font-style:\"normal\"; color:#000000;" }




정규식만 잘 이용하면 CSS 파서 만드는 것도 어렵지 않을 것 같네요~
그 잘 이용하는게 어려울 뿐이죠...



Posted by 자수씨
, |

원본           : (2010. 03. 20.)
추출 데이터 : 2010-03-20

어떤 방법으로 해당 데이터를 추출할 수 있을까요?





Posted by 자수씨
, |

1. 자연수, 0


2. 정수


3. 소수


음.. 규식이는 더 공부를 해줘야 할듯~~ 이제 NumberFormatException 에 의존하는 일은 없으~~

Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백