这篇教程C++ swscanf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中swscanf函数的典型用法代码示例。如果您正苦于以下问题:C++ swscanf函数的具体用法?C++ swscanf怎么用?C++ swscanf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了swscanf函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SelectChildNodevoid COFSNcDlg2::LoadColor(IXMLDOMNode *pRoot, LPCTSTR szName, COLORREF &cr){ CComBSTR bs, bsSelect; cr = CLR_NONE; bs.Empty(); bsSelect = L"Color[@Name='"; bsSelect += szName; bsSelect += L"']"; SelectChildNode(pRoot, bsSelect, NULL, &bs); if(bs.m_str != NULL) { long ncr; int n = swscanf(bs.m_str, L"0x%06x", &ncr); if(n == 1) cr = ncr; }}
开发者ID:alex765022,项目名称:IBN,代码行数:19,
示例2: HandleSelectDraftSchematicbool CraftingManager::HandleSelectDraftSchematic(Object* object,Object* target,Message* message,ObjectControllerCmdProperties* cmdProperties){ PlayerObject* playerObject = dynamic_cast<PlayerObject*>(object); CraftingSession* session = playerObject->getCraftingSession(); //DraftSchematic* schematic = NULL; BString dataStr; uint32 schematicIndex = 0; message->getStringUnicode16(dataStr); if(session) { if(swscanf(dataStr.getUnicode16(),L"%u",&schematicIndex) != 1 || !session->selectDraftSchematic(schematicIndex)) { gCraftingSessionFactory->destroySession(session); } } return true;}
开发者ID:ANHcRush,项目名称:mmoserver,代码行数:19,
示例3: string2Regionbool string2Region(const wchar_t* _str , xuiRegion& region){ static std::wstring str; str=L""; static std::wstring typeStr; typeStr = L""; int i = 0; for(i = 0 ; i < (int)wcslen(_str) ; i ++) { if(_str[i] == '[') { break; } if( _str[i] != ' ' && _str[i] != '/t') { typeStr.push_back(_str[i]); } } for(; i < (int)wcslen(_str) ; i ++) { if(_str[i] != ' ' && _str[i] != '/t') { str.push_back(_str[i]); } } if(typeStr == L"rect" || typeStr == L"RECT" || typeStr == L"Rect") { stringToRect(str.c_str() , region.Rect2D() ); region._type = xuiRegion::eRT_Rect; } else if(typeStr == L"DELTA" || typeStr == L"delta" || typeStr == L"Delta") { float x , y , w , h; swscanf(str.c_str(),L"[%f,%f,%f,%f]",&x,&y,&w,&h); region.Rect2D().x += x; region.Rect2D().y += y; region.Rect2D().w += (w - x) ; region.Rect2D().h += (h - y) ; } return true;}
开发者ID:wangscript,项目名称:evolution3d,代码行数:43,
示例4: void Skein::Node::OverwriteBanner(CStringW& inStr){ // Does this text contain an Inform 7 banner? int i = inStr.Find(L"/nRelease "); if (i >= 0) { int release, serial, build; if (swscanf((LPCWSTR)inStr+i,L"/nRelease %d / Serial number %d / Inform 7 build %d",&release,&serial,&build) == 3) { // Replace the banner line with asterisks for (int j = i+1; j < inStr.GetLength(); j++) { if (inStr.GetAt(j) == '/n') break; inStr.SetAt(j,'*'); } } }}
开发者ID:DavidKinder,项目名称:Windows-Inform7,代码行数:19,
示例5: getULstatic bool getUL(const VARIANT& v, unsigned long& val){ switch (v.vt) { case VT_BSTR: { unsigned long ul; char c; if (swscanf(_bstr_t(v.bstrVal), L" %lu %c", &ul, &c) != 1) return false; val = ul; } break; default: { val = _variant_t(v).operator unsigned long(); break; } } return true;}
开发者ID:artemeliy,项目名称:inf4715,代码行数:19,
示例6: unsignedCMssqlField::operator unsigned(){ switch(ctype) { case SQL_C_WCHAR: { unsigned ret=0; swscanf((const wchar_t *)data,L"%u",&ret); return ret; } case SQL_C_LONG: return (unsigned)*(long*)data; case SQL_C_DOUBLE: return (unsigned)*(double*)data; default: CServerIo::trace(1,"Bogus value return for field %s",name.c_str()); return 0; }}
开发者ID:surfnzdotcom,项目名称:cvsnt-fork,代码行数:19,
示例7: extfunc_getNumstatic PyObject* extfunc_getNum(PyObject *self, PyObject *args) { wchar_t *ret = go_internal(args, 1); if (!ret) return NULL; float ret2; if (swscanf(ret, L"%g", &ret2)) { free(ret); PyObject *ret3 = PyFloat_FromDouble(ret2); return ret3; } else { char buf[256]; char *cret = wc2c(ret, 1); sprintf(buf, "No numeric value found in Info window output: %s", cret); free(cret); PyErr_SetString(g_PrPyExc, buf); return NULL; }}
开发者ID:tufla,项目名称:praat-py,代码行数:19,
示例8: whileTsubtitle* TsubtitleParserSubrip09::parse(Tstream &fd, int flags, REFERENCE_TIME start, REFERENCE_TIME stop){ wchar_t line[this->LINE_LEN + 1]; int a1, a2, a3; const wchar_t * next = NULL; int i; while (1) { // try to locate next subtitle if (!fd.fgets(line, this->LINE_LEN)) { return NULL; } if (!(swscanf(line, L"[%d:%d:%d]", &a1, &a2, &a3) < 3)) { break; } } TsubtitleText current(this->format); current.start = this->hmsToTime(a1, a2, a3); if (previous != NULL) { previous->stop = current.start - 1; } if (!fd.fgets(line, this->LINE_LEN)) { return NULL; } next = line; i = 0; //(*current)[0]=""; // just to be sure that string is clear while ((next = sub_readtext(next, current)) != NULL) { i++; } if (current.size() == 0 || (current.at(0)[0] == '/0') && (i == 0)) { // void subtitle -> end of previous marked and exit previous = NULL; return NULL; } return previous = store(current);}
开发者ID:xinjiguaike,项目名称:ffdshow,代码行数:43,
示例9: currentTsubtitle* TsubtitleParserSubrip::parse(Tstream &fd, int flags, REFERENCE_TIME start, REFERENCE_TIME stop){ wchar_t line[this->LINE_LEN + 1]; int a1, a2, a3, a4, b1, b2, b3, b4; wchar_t *p = NULL, *q = NULL; int len; TsubtitleText current(this->format); while (1) { if (!fd.fgets(line, this->LINE_LEN)) { return NULL; } if (flags & this->PARSETIME) { if (swscanf(line, L"%d:%d:%d.%d,%d:%d:%d.%d", &a1, &a2, &a3, &a4, &b1, &b2, &b3, &b4) < 8) { continue; } current.start = this->hmsToTime(a1, a2, a3, a4); current.stop = this->hmsToTime(b1, b2, b3, b4); if (!fd.fgets(line, this->LINE_LEN)) { return NULL; } } p = q = line; for (;;) { for (q = p, len = 0; *p && *p != '/r' && *p != '/n' && *p != '|' && strncmp(p, L"[br]", 4); p++, len++) { ; } current.add(q, len); if (!*p || *p == '/r' || *p == '/n') { break; } if (*p == '|') { p++; } else while (*p++ != ']') { ; } } break; } return store(current);}
开发者ID:xinjiguaike,项目名称:ffdshow,代码行数:42,
示例10: ASSERTBOOL CColumnChooserLC::OnDrop(CWnd* /* pWnd */, COleDataObject* pDataObject, DROPEFFECT /* dropEffect */, CPoint /* point */){ // On Drop of column from Header onto Column Chooser Dialog if (!pDataObject->IsDataAvailable(m_ccddCPFID, NULL)) return FALSE; HGLOBAL hGlobal; hGlobal = pDataObject->GetGlobalData(m_ccddCPFID); LPCWSTR pData = (LPCWSTR)GlobalLock(hGlobal); ASSERT(pData != NULL); DWORD procID; int iDDType, dw_type, iLen;#if (_MSC_VER >= 1400) swscanf_s(pData, L"%08x%02x%02x%04x", &procID, &iDDType, &dw_type, &iLen);#else swscanf(pData, L"08x%02x%02x%04x", &procID, &iDDType, &dw_type, &iLen);#endif // Check if it is ours? // - we don't accept drop from other instances of PWS // Check if it is from List View HeaderCtrl? // - we don't accept drop from anything else if ((procID != GetCurrentProcessId()) || (iDDType != FROMHDR)) { GlobalUnlock(hGlobal); return FALSE; } // Now add it const CString cs_header(pData + 16, iLen); int iItem = InsertItem(0, cs_header); SetItemData(iItem, dw_type); SortItems(CCLCCompareProc, (LPARAM)this); GlobalUnlock(hGlobal); GetParent()->SetFocus(); return TRUE;}
开发者ID:macduff,项目名称:passwordsafe,代码行数:42,
示例11: CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_22_badSinkvoid CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_22_badSink(wchar_t * data){ if(CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_22_badGlobal) { { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } }}
开发者ID:maurer,项目名称:tiamat,代码行数:20,
示例12: GetWindowTextint CNumEdit::IsValidSymble()const{ CString str; GetWindowText(str); int res = VALID; float f; char lp[10]; if ((str.GetLength() == 1) && ((str[0] == '+') || (str[0] == '-'))) res = MINUS_PLUS; else#ifdef UNICODE if (swscanf(str, _T("%f%s"), &f, lp) != 1) res = INVALID_CHAR;#else if (sscanf(str, _T("%f%s"), &f, lp) != 1) res = INVALID_CHAR;#endif return res;}
开发者ID:mdmitry1973,项目名称:CShell,代码行数:20,
示例13: retvalCOLORREF CRichEditCtrlExtn::ConvertColourToColorRef(CString &csValue){ // Value is either a colour name or "#RRGGBB" // Note COLORREF = 0x00bbggrr but HTML = 0x00rrggbb // Values for named colours here are in COLORREF format long retval(0L); if (csValue.Left(1) == L"#") { // Convert HTML to COLORREF ASSERT(csValue.GetLength() == 7); int icolour;#if (_MSC_VER >= 1400) swscanf_s(csValue.Mid(1), L"%06x", &icolour);#else swscanf(csValue.Mid(1), L"%06x", &icolour);#endif int ired = (icolour & 0xff0000) >> 16; int igreen = (icolour & 0xff00); int iblue = (icolour & 0xff) << 16; return (COLORREF)(iblue + igreen + ired); }
开发者ID:wcremeika,项目名称:thesis,代码行数:20,
示例14: CWE252_Unchecked_Return_Value__wchar_t_sscanf_15_badvoid CWE252_Unchecked_Return_Value__wchar_t_sscanf_15_bad(){ switch(6) { case 6: { /* By initializing dataBuffer, we ensure this will not be the * CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() and other variants */ wchar_t dataBuffer[100] = L""; wchar_t * data = dataBuffer; /* FLAW: Do not check the return value */ swscanf(SRC, L"%99s/0", data); } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; }}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:20,
示例15: badSinkstatic void badSink(wchar_t * data){ if(badStatic) { { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } }}
开发者ID:maurer,项目名称:tiamat,代码行数:20,
示例16: printIntLinevoid CWE606_Unchecked_Loop_Condition__wchar_t_file_82_goodB2G::action(wchar_t * data){ { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* FIX: limit loop iteration counts */ if (n < MAX_LOOP) { intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } }}
开发者ID:maurer,项目名称:tiamat,代码行数:20,
示例17: GetGUID//Function: GetGUID//Purpose: Conversts a string containing the GUID into a GUID datatype.//Input: string cotaining the GUID//Output: GUID type//Return: Returns -1 in case of an error, otherwise returns zero.int RhoBluetoothManager::GetGUID(WCHAR *psz, GUID *pGUID) { int data1, data2, data3; int data4[8]; if (11 == swscanf(psz, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x/n", &data1, &data2, &data3, &data4[0], &data4[1], &data4[2], &data4[3], &data4[4], &data4[5], &data4[6], &data4[7])) { pGUID->Data1 = data1; pGUID->Data2 = data2 & 0xffff; pGUID->Data3 = data3 & 0xffff; for (int i = 0 ; i < 8 ; ++i) pGUID->Data4[i] = data4[i] & 0xff; return 0; } return -1;}
开发者ID:wave2future,项目名称:rhodes,代码行数:25,
示例18: parseTsubtitle* TsubtitleParserDunnowhat::parse(Tstream &fd, int flags, REFERENCE_TIME, REFERENCE_TIME){ wchar_t line[this->LINE_LEN + 1]; wchar_t text[this->LINE_LEN + 1]; if (!fd.fgets(line, this->LINE_LEN)) { return NULL; } long start, stop; if (swscanf(line, L"%ld,%ld,/"%[^/"]", &start, &stop, text) < 3) { return NULL; } TsubtitleText current(this->format); current.start = this->frameToTime(start); current.stop = this->frameToTime(stop); current.add(text); return store(current);}
开发者ID:xinjiguaike,项目名称:ffdshow,代码行数:20,
示例19: snamebool StatsSet::getInt64( const char *name, long long int *val ){ std::wstring value; std::string sname( name ); std::map<std::string, std::wstring>::const_iterator iter = m_map.find( sname ); if( iter == m_map.end() ) { throw Exception( "StatsSet: trying to get non-existent Int64 var [%s] with no default value!", name ); //return false; // warning C4702: unreachable code } value = iter->second; long long int i64 = 0; int r = swscanf( value.c_str(), L"%I64d", &i64 ); if( r == 1 ) { (*val) = i64; return true; } throw Exception( "StatsSet.getInt: failed to scanf %%I64d from [%s]=[%S]", name, value.c_str() );}
开发者ID:minlexx,项目名称:l2-unlegits,代码行数:20,
示例20: ExecuteBangPLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args){ MeasureData* measure = (MeasureData*)data; const WCHAR* pos = wcschr(args, L' '); if (pos) { size_t len = pos - args; if (_wcsnicmp(args, L"SendMessage", len) == 0) { ++pos; // Parse parameters DWORD uMsg, wParam, lParam; if (3 == swscanf(pos, L"%u %u %u", &uMsg, &wParam, &lParam)) { HWND hwnd = FindWindow( measure->windowClass.empty() ? nullptr : measure->windowClass.c_str(), measure->windowName.empty() ? nullptr : measure->windowName.c_str()); if (hwnd) { PostMessage(hwnd, uMsg, wParam, lParam); } else { RmLog(LOG_ERROR, L"WindowMessagePlugin.dll: Unable to find window"); } } else { RmLog(LOG_WARNING, L"WindowMessagePlugin.dll: Incorrect number of arguments for bang"); } return; } } RmLog(LOG_WARNING, L"WindowMessagePlugin.dll: Unknown bang");}
开发者ID:ATTRAYANTDESIGNS,项目名称:rainmeter,代码行数:41,
示例21: Getvoid Parser::Expon(int &p) { char *name; if (la->kind == 2) { Get(); swscanf(t->val, L"%d",&p); } else if (la->kind == 1) { Get(); map<string, int>::iterator it = tab->find(coco_string_create_char(t->val)); if(it != tab->end()){ p = it->second; }else{ p = 0; printf("Unknowen var/n"); } } else if (la->kind == 15) { Get(); Expr(p); Expect(16); } else SynErr(18);}
开发者ID:Divo,项目名称:twominutestomidnightIMPORT,代码行数:21,
示例22: WorldTargetAddEnt/////////////////////////////////////// Name: WorldTargetAddEnt// Purpose: add a target based on given// entity parse// Output: new target added// Return: none/////////////////////////////////////void WorldTargetAddEnt(const EntityParse & entityDat){ const tCHAR * pName = entityDat.GetVal(L"targetname"); wstring theName = pName ? pName : L"NULL"; Vec3D theLoc(0,0,0); //bad target if(theName.c_str()[0] == 0) return; //get location if(entityDat.GetVal(L"origin")) { swscanf(entityDat.GetVal(L"origin"), L"%f %f %f", &theLoc.x, &theLoc.z, &theLoc.y); theLoc.z *= -1; } //add to list WorldTargetSet(theName.c_str(), theLoc);}
开发者ID:ddionisio,项目名称:Mahatta,代码行数:28,
示例23: goodG2Bstatic void goodG2B(){ wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; data = CWE606_Unchecked_Loop_Condition__wchar_t_connect_socket_61b_goodG2BSource(data); { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } }}
开发者ID:maurer,项目名称:tiamat,代码行数:21,
示例24: goodB2GSink/* goodB2G() uses the BadSource with the GoodSink */static void goodB2GSink(){ wchar_t * data = CWE606_Unchecked_Loop_Condition__wchar_t_connect_socket_45_goodB2GData; { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* FIX: limit loop iteration counts */ if (n < MAX_LOOP) { intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } }}
开发者ID:maurer,项目名称:tiamat,代码行数:22,
示例25: HandleCreatePrototypebool CraftingManager::HandleCreatePrototype(Object* object, Object* target,Message* message, ObjectControllerCmdProperties* cmdProperties){ PlayerObject* player = dynamic_cast<PlayerObject*>(object); CraftingSession* session = player->getCraftingSession(); BString dataStr; uint32 mode,counter; if(!session) return false; message->getStringUnicode16(dataStr); if(swscanf(dataStr.getUnicode16(),L"%u %u",&counter,&mode) != 2) { gCraftingSessionFactory->destroySession(player->getCraftingSession()); return false; } session->createPrototype(mode,counter); return true;}
开发者ID:ANHcRush,项目名称:mmoserver,代码行数:21,
示例26: goodB2G2/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */static void goodB2G2(){ wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; if(staticReturnsTrue()) { { /* Append input from an environment variable to data */ size_t dataLen = wcslen(data); wchar_t * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ wcsncat(data+dataLen, environment, 100-dataLen-1); } } } if(staticReturnsTrue()) { { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* FIX: limit loop iteration counts */ if (n < MAX_LOOP) { intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } } }}
开发者ID:maurer,项目名称:tiamat,代码行数:41,
示例27: goodG2B2/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first switch */static void goodG2B2(){ wchar_t * data; wchar_t dataBuffer[100] = L""; data = dataBuffer; switch(6) { case 6: /* FIX: Set data to a number less than MAX_LOOP */ wcscpy(data, L"15"); break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; } switch(7) { case 7: { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); break; }}
开发者ID:maurer,项目名称:tiamat,代码行数:41,
示例28: _wtoi//---------------------------------------------------------------------------------------------// Name:// Desc://---------------------------------------------------------------------------------------------HRESULT CManipulator::InitPredefinedPositions(wchar_t* file){ int i,j; cprimitive* primitive; wchar_t *outdata = new wchar_t[512]; // setup predefined positions numPredefinedPos = _wtoi( IniRead(file, L"predefined_positions", L"quantity") ); //1st - straight stick for(i=0; i < numPredefinedPos; i++) { wchar_t string[512]; wsprintf(string, L"predefined_%d", (i)); //name outdata = new wchar_t[512]; wsprintf(outdata, L"%s", IniRead(file, string, L"name")); predefinedPositionNames.push_back( new LPWSTR(outdata) ); //angles D3DXVECTOR2* angles; angles = new D3DXVECTOR2[numOfChains]; for(j=0; j < numOfChains; j++) { D3DXVECTOR2 vec2; wchar_t index[256]; _itow(j,index,10); swscanf( IniRead(file, string, index), L"%f %f", &(vec2.x), &(vec2.y)); angles[j] = vec2; } predefinedPositions.push_back(angles); } return S_OK;}
开发者ID:m10914,项目名称:Sphere,代码行数:44,
示例29: good1/* good1() uses if(GLOBAL_CONST_FIVE!=5) instead of if(GLOBAL_CONST_FIVE==5) */static void good1(){ if(GLOBAL_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { /* By initializing dataBuffer, we ensure this will not be the * CWE 690 (Unchecked Return Value To NULL Pointer) flaw for fgetws() and other variants */ wchar_t dataBuffer[100] = L""; wchar_t * data = dataBuffer; /* FIX: check for the correct return value */ if (swscanf(SRC_STRING, L"%99s/0", data) == EOF) { printLine("swscanf failed!"); } } }}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:23,
注:本文中的swscanf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ swscanf_s函数代码示例 C++ sws_scale函数代码示例 |