トップ 差分 一覧 ping ソース 検索 ヘルプ PDF RSS ログイン

Excel VBA テーブル定義からJavaプロパティ名称作成



目次



記事一覧

キーワード

Excel VBA テーブル定義からJavaプロパティ名称作成

[Excel VBA]

'
' Upper Snake Case の列定義を、Java プロパティに変換
'
Public Function ColumnDefToJavaBeanProperty(coldef As String)
    Dim c                       As String
    Dim i                       As Integer
    Dim ret                     As String
    Dim isFirstAlphaFound       As Boolean
    Dim isSep                   As Boolean
    
    coldef = LCase$(coldef)
    
    isFirstAlphaFound = False
    
    For i = 1 To Len(coldef)
        c = Mid$(coldef, i, 1)
        If c = "_" Then
            isSep = True
        Else
            
            If isSep And isFirstAlphaFound Then
                c = UCase$(c)
            End If
            
            isFirstAlphaFound = True
            isSep = False
            ret = ret + c
        End If
    Next
    
    ColumnDefToJavaBeanProperty = ret
End Function



YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto

Copyright© 矢木 浩人 All Rights Reserved.